|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
dinamically-created checkbox doesn't load it's stateCreateChildControls function and in it i call my function to create some dinamic controls before base.CreateChildControls(). In my function i create some controls: checkboxes, drop-downlists and so on. If i fill this controls with values when page is displayed in browser, after postback checkboxes lose their values, while other controls not. I use this code to create checkboxes private HtmlTableCell CreateCheckboxCell( string controlName, string displayOption ) { HtmlTableCell cell = new HtmlTableCell(); CheckBox chb = new CheckBox(); chb.ID = "_" + controlName + "_"; chb.Width = new Unit( "100%" ); if( displayOption == "read-only" ) { chb.Enabled = false; } cell.Controls.Add( chb ); return cell; } and, for example, this, to create dropdownlists: private HtmlTableCell CreateDropdownCell( string controlName, string displayOption, Dictionary<string, string> values ) { HtmlTableCell cell = new HtmlTableCell(); DropDownList ddl = new DropDownList(); ddl.ID = "_" + controlName + "_"; ddl.Width = new Unit( "100%" ); if( displayOption == "read-only" ) ddl.Enabled = false; ddl.Items.Clear(); foreach( KeyValuePair<string, string> pair in values ) { ddl.Items.Add( new ListItem( pair.Value, pair.Key ) ); } cell.Controls.Add( ddl ); return cell; } i don't see any principal differences between these two methods and i don't understand why dropdownlists restore their values from form data and checkboxes don't. If anybody has any ideas - give me, pls.
Conditional True/False output for datalist item
error: can't find control 'mylabel' which expert can finally solve this? WSS document event handler that will use System.web.mail sendmail Disappearing Web Part Trick Dynamic gridview values lost on postback Center Login Control and Firefox Admin front end generator How to access a server control within a repeater control Using Control.Render() from a page with a MasterPage |
|||||||||||||||||||||||