|
-
April 4th, 2003, 01:53 PM
#1
Wrong value from TextBox within a UserControl
-- NEVER MIND --
I figured it out. It was all about how I populated the textboxes. I did it in the textboxes' parent usercontrol's Page_Load event, while I had to do it in the dropdown's parent usercontrol's SelectedIndexChanged event.
-------------
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!
Last edited by Dreamon; April 4th, 2003 at 04:15 PM.
Do what thou wilt, shall be the whole of the law.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|