Last post Jun 30, 2005 10:30 AM by bmains
Jun 30, 2005 06:50 AM|krsouthern|LINK
TextBox box1 =
Button myButt =
When I add this control to a page, on postback the textbox loses it value?
Jun 30, 2005 09:40 AM|AgileXML|LINK
Jun 30, 2005 10:11 AM|mw:17:61|LINK
1. CreateChildContols is called at the very last moment by default (around PreRender stage). So add lines
void OnInit(EventArgs e)
if ( Page.IsPostBack )
to create internal controls before it is too late to handle post back data
Jun 30, 2005 10:30 AM|bmains|LINK
I would consider storing the control as a private variable, so it is accessible throughout the page. Then, have the text property return the textbox's text property instead of a custom variable. Make sure this.EnsureChildControls(); is called before accessing
the control's property.