1
Answer

Wrong value from TextBox within a UserControl

Administrator

Administrator

21y
1.4k
1
Yet another problem regarding usercontrols! I thought that using usercontrols would be so great and easy, but it turns out to be rather difficult I think. Anyway, I have a page with three usercontrols. One with a bunch of TextBoxes, another with a submit button and the third with a DropDownList (autopostback = true). When you select something from the dropdown, the textboxes in the second usercontrol will be get values from a database. NOW, if I change the values in the textboxes (after they have been filled with data) and hit the submit button in the third usercontrol, I only get the original values from the textboxes and not the new one I typed in. I have tried the following codes: Page1 oP1 = (Page1)LoadControl("Page1.ascx"); oP1 = (Page1)Page.FindControl("oPage1"); Response.Write(oP1.JobAppliedFor); oText = new TextBox(); oText = (TextBox)this.Parent.FindControl("oTextJobAppliedFor"); Response.Write(oText.Text); // property Response.Write(oP1.oTextJobAppliedFor.Text); // public textbox They all return the original value. So how the heck am I suppose to get the NEW value?? I am very confused and will be utterly happy if someone could help me out!! Thanks!
Answers (1)