:laugh: yeahhh.. it won't go in catch block ever.
**
R A M
**
:laugh: yeahhh.. it won't go in catch block ever.
**
**
here is another gem by my colleague. I believe he was drunk when he wrote this as I don't think he would do this in senses.
Page executingPage = null;
try
{
executingPage = HttpContext.Current.Handler as Page;
}
catch(InvalidCastException ex)
{
executingPage = HttpContext.Current.Handler as Page;
}
**
**
There was this guy who joined our team as a trainee. Who, according to him, had enough knowledge of .NET specially exception handling..later on i found his code full of TRY CATCH literally on each line .. something like this.. int budgetAmount =0; try { budgetAmount = 10; }catch(Exception ex) { } try { if(budgetAmount==10) budgetAmount += (baselineAmount * actualAmount); }catch(Exception ex) { } and so on
**
**
I found this some one posted in ASP.NET questions today, What could be the possible reason to set same encoding with conditional statement?
**
**
if (lang == "Japanese")
{
msg.BodyEncoding = System.Text.Encoding.UTF8;
msg.SubjectEncoding = System.Text.Encoding.UTF8;
}
else
{
msg.BodyEncoding = System.Text.Encoding.UTF8;
msg.SubjectEncoding = System.Text.Encoding.UTF8;
}
**
**
I understand.. but my point is will that read anything after first line as Object to read file is initiated EVERYTIME in loop
**
**
Loop should exit on first exception if there is no try block. I agree with you in this case it wouldn't stop excuting as it has a catch block. But I wonder if it will ever throw end of file exception? as everytime a new Object is created against physical file that would start reading file from start so there would be no end of file ever. but it could throw infinite loop exception though? Your thoughts?
**
**
I want to implement Paging on Master Detail Layout but i dont know how it will work because i can only set one pageddatasource at a time for either master or child record... please help me
**
**
I have 2 Repeaters with ProductCategory and ProductDetail Architecture.. i.e master detail Wot i want to do is ... enable the paging as a whole rather than ProductCategory or ProductDetail .. Here is sample code for it strSQL = "SELECT ProductID, ShortDesc, LongDesc, SubCategoryID, PictureUrl, ProductCatID, DataSheetUrl " & _ " FROM dbo.Products ORDER BY ProductID" '& Request.QueryString("subid") strSqlMain = "SELECT ProductCatID, Description, SubCategoryID FROM dbo.ProductCategory Where SubCategoryID=" & Request.QueryString("subid") clsCon.MakeDataSet(strSQL, dsProduct) clsCon.MakeDataSet(strSqlMain, ds) ds.Tables(0).TableName = "Main" ds.Tables.Add(dsProduct.Tables(0).Copy()) ds.Tables(1).TableName = "Products" Dim str1(0) As String Dim str2(0) As String Dim dr As DataRelation = New DataRelation("ProductCat", ds.Tables("Main").Columns("ProductCatID"), ds.Tables("Products").Columns("ProductCatID"), False) ds.Relations.Add(dr) rptCategory.DataSource = ds rptCategory.DataBind() clsCon.sqlConnection.Close()
And the ItemDataBound Event of Master Repeater is Protected Sub BindChild(ByVal source As System.Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then If (CType(e.Item.DataItem, DataRowView).CreateChildView("ProductCat")).Count > 0 Then Dim rpt As Repeater = e.Item.Controls(3) Dim dsPaged As New PagedDataSource dsPaged.DataSource = (CType(e.Item.DataItem, DataRowView).CreateChildView("ProductCat")) dsPaged.AllowPaging = True dsPaged.PageSize = 7 dsPaged.CurrentPageIndex = CurrentPage lblCurrent.Text = "Page: " & (CurrentPage + 1).ToString & " of " & _ dsPaged.PageCount.ToString lblPrevious.Enabled = Not dsPaged.IsFirstPage lblNext.Enabled = Not dsPaged.IsLastPage rpt.DataSource = dsPaged rpt.DataBind() End If End If End Sub
now problem is It makes the Paging enable on Product Repeater meanz .. if i have a Categories like CAT-A CAT-B,CAT-C and all of these categories has 10 items each .. then paging will work as first page will populate with 7 records of A,B,C, e
You can use DataList for this purpose as and provide your data to be shown in ItemTemplate tag in html .. like this put it in ItemTemplate of DataList R A M
Thanx alot minhpc_bk .. so nice of you ..**
**
I m setting through code behind and value is not null when i set it to XMLDataSource property. It assigns the value correctly because i have checked through debugging. I think there is some problem with declaring the control .. isnt it?**
**
I have a custom control with two properties and one overrided method render .. whenever i assign DataTable to one property i preserves it but when the render function is called its value is null here is my code using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; namespace Nav { /// /// Summary description for ucMenu /// [ToolboxData("<{0}:ucMenu runat=server>")] public class ucMenu : WebControl { DataTable _dtMenu; string _id; public ucMenu() { // // TODO: Add constructor logic here // //_dsMenu = new DataSet(); } public DataTable XMLDataSource { get { return (_dtMenu); } set { _dtMenu = value.Copy(); } } public string NavID { get { return (_id); } set { _id = value; } } protected override void Render(HtmlTextWriter writer) { writer.Write(" "); if (_dtMenu != null) { for (int i = 0; i < _dtMenu.Rows.Count; i++) { writer.Write("* [" + _dtMenu.Rows[i]["text"].ToString() + "]( + _dtMenu.Rows[i][) "); } } writer.Write(" "); writer.Flush(); base.Render(writer); } } }
IN HTML i m embedding it as <
MyBar:ucMenu ID="UcMenu1" runat="server" /> and in code behind protected ucMenu MyBar = new ucMenu(); on top of class can you please tell me why my datatable refernce to null in render even i have ref it to datatable from property**
**
I want to develop sqlserver monitor ,tunerand analyzer please can you guide me how can i do this .. just give me a guideline .. or any opensource lib and prj u know Features should include: Monitor SQL Server Hardware requirements are Utilization and Performance Monitor CPU, memory, and the I/O subsystem percentages Monitor disk operations (reads/writes) and network traffic Correlate system utilization with user connections and SQL code Diagnose Executed SQL Code Performance, Connections, and SQL Server Blocking Analyze and chart slow performing SQL statements and stored procedures Report the cost (Duration, CPU time, & disk reads/writes) of each statement etc etc**
**
I want to implement Audio Chat Server in ASP.NET Can you please guide me in this regard like how can i implement what packages will be used or if there is any opensource chat server in .NET kindly tell me. and approx how much time it will take me to implement**
**
thanx alot Vuks .. i will get back to you if i face some problem in this script .. thanks again**
**
I want to detect if the client browser is using popupblocker or not.. or is there any solution to popup a window regardless of that popblocker as Hotmail and yahoo shows popupwindow on deleteing of emails thanx in advance**
**
I want to detect if the client browser is using popupblocker or not.. or is there any solution to popup a window regardless of that popblocker as Hotmail and yahoo shows popupwindow on deleteing of emails thanx in advance**
**
use paged data source like this Dim dsPaged As New PagedDataSource dsPaged.DataSource = ds.Tables(0).DefaultView dsPaged.AllowPaging = True dsPaged.PageSize = 5
it is more flexible**
**
I have got the solution ... Forms Collection is used for Loaded forms in memory so Forms.Add(rs("FormName")) for each frm in forms if frm.name="Form2" then frm.show end if**
**