Problems with ASP.NET 2.0
-
Hello, I am trying to convert this application I am working on from ASP.NET 1.1 to 2.0, and certain things are not working as they should. One thing is the code below
TextBox txtCompleted = new TextBox(); TextBox txtProjected = new TextBox(); position = j+1; CheckBox chk = Page.FindControl("chk_"+ j + "_" + ContractNum) as CheckBox; txtCompleted = Page.FindControl("txtCompleted_"+j+"_"+ContractNum) as TextBox; txtProjected = Page.FindControl("txtProjected_"+j+"_"+ContractNum) as TextBox; completed = txtCompleted.Text.Trim(); projected = txtProjected.Text.Trim(); CheckList_ID = int.Parse(CheckListID.Rows[j]["ID"].ToString());
In .NET 1.1 completed and projected get the values of the text boxes after the user clicks save, but in 2.0 this doesn't seem to work, I was wondering if anyone had any suggestions. Sincerely, The Major Rager -
Hello, I am trying to convert this application I am working on from ASP.NET 1.1 to 2.0, and certain things are not working as they should. One thing is the code below
TextBox txtCompleted = new TextBox(); TextBox txtProjected = new TextBox(); position = j+1; CheckBox chk = Page.FindControl("chk_"+ j + "_" + ContractNum) as CheckBox; txtCompleted = Page.FindControl("txtCompleted_"+j+"_"+ContractNum) as TextBox; txtProjected = Page.FindControl("txtProjected_"+j+"_"+ContractNum) as TextBox; completed = txtCompleted.Text.Trim(); projected = txtProjected.Text.Trim(); CheckList_ID = int.Parse(CheckListID.Rows[j]["ID"].ToString());
In .NET 1.1 completed and projected get the values of the text boxes after the user clicks save, but in 2.0 this doesn't seem to work, I was wondering if anyone had any suggestions. Sincerely, The Major RagerTheMajorRager wrote:
txtCompleted = Page.FindControl("txtCompleted_"+j+"_"+ContractNum) as TextBox; txtProjected = Page.FindControl("txtProjected_"+j+"_"+ContractNum) as TextBox;
If these controls already exist on your page why not call them directly rather than use FindControl?
only two letters away from being an asset
-
Hello, I am trying to convert this application I am working on from ASP.NET 1.1 to 2.0, and certain things are not working as they should. One thing is the code below
TextBox txtCompleted = new TextBox(); TextBox txtProjected = new TextBox(); position = j+1; CheckBox chk = Page.FindControl("chk_"+ j + "_" + ContractNum) as CheckBox; txtCompleted = Page.FindControl("txtCompleted_"+j+"_"+ContractNum) as TextBox; txtProjected = Page.FindControl("txtProjected_"+j+"_"+ContractNum) as TextBox; completed = txtCompleted.Text.Trim(); projected = txtProjected.Text.Trim(); CheckList_ID = int.Parse(CheckListID.Rows[j]["ID"].ToString());
In .NET 1.1 completed and projected get the values of the text boxes after the user clicks save, but in 2.0 this doesn't seem to work, I was wondering if anyone had any suggestions. Sincerely, The Major RagerAS well as the previous comment, why would you write code that calls FindControl and has no block to make sure that it succeeded ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog