Anyone familiar with server controls?<BR><BR>I&#039;m trying to write a composite server control that contains a CheckBox and a CheckBoxList. When the lone CheckBox is checked, a postback occurs and checks all the individual CheckBoxes within the CheckBoxList. That works fine.<BR><BR>Now I&#039;m trying to allow the CheckBoxList portion to be databound, which also works but only for the first page hit. When the postback occurs, the databinding fails without an error, because the DataSource, DataTextField, and DataValueField are all null. So I end up without the CheckBoxList in the output.<BR><BR>I suspect I&#039;m doing something wrong with the databinding. I&#039;m still learning server controls... I ran it in debug mode and the code to create the control happened prior to Page_Load, unlike the first time the page is loaded. So obviously that&#039;s why the databinding isn&#039;t working. What&#039;s the correct methodology for this sort of thing?<BR><BR>Here&#039;s the control:<BR><BR>using System;<BR>using System.Web.UI;<BR>using System.Web.UI.WebControls;<BR>using System.Data;<BR>using System.Data.OracleClient;<BR>using System.Collections;<BR><BR>namespace WebProject1 {<BR><BR> public class MySelectAll : Control, INamingContainer {<BR><BR> private CheckBoxList _cbl;<BR> private IEnumerable _dataSource;<BR> private string _dataTextField;<BR> private string _dataValueField;<BR><BR> public IEnumerable DataSource {<BR> get {return _dataSource;}<BR> set {_dataSource = value;}<BR> }<BR><BR> public string DataTextField {<BR> get {return _dataTextField;}<BR> set {_dataTextField = value;}<BR> }<BR><BR> public string DataValueField {<BR> get {return _dataValueField;}<BR> set {_dataValueField = value;}<BR> }<BR><BR> protected override void CreateChildControls() {<BR> <BR> CheckBox cb = new CheckBox();<BR> cb.Text = "click me";<BR> cb.CheckedChanged += new EventHandler(SelectAll);<BR> cb.AutoPostBack = true;<BR> Controls.Add(cb);<BR><BR> _cbl = new CheckBoxList();<BR>/* for (int i=0; i&#060;5; i++) {<BR> ListItem li = new ListItem("bogus item", i.ToString());<BR> cbl.Items.Add(li);<BR> }*/<BR> _cbl.DataSource = _dataSource;<BR> _cbl.DataTextField = _dataTextField;<BR> _cbl.DataValueField = _dataValueField;<BR> _cbl.DataBind();<BR> Controls.Add(_cbl);<BR><BR> }<BR><BR> private void SelectAll(object sender, EventArgs e) {<BR><BR> bool isChecked = ((CheckBox)sender).Checked;<BR><BR> //this.EnsureChildControls();<BR><BR> CheckBoxList cbl = (CheckBoxList)Controls[1];<BR> foreach (ListItem li in cbl.Items) {<BR> li.Selected = isChecked;<BR> }<BR><BR> }<BR><BR> }<BR>}<BR><BR><BR>In the Page_Load of the host page, I have this:<BR><BR><BR> string sql = <BR> @"SELECT<BR> serv_loc_id,<BR> serv_loc_desc<BR> FROM<BR> ace_serv_loc<BR> WHERE<BR> billing_system_acct_nbr = :acctNbr ";<BR><BR> OracleConnection conn = new OracleConnection([obfuscated]);<BR> OracleCommand cmd = new OracleCommand(sql, conn);<BR> cmd.Parameters.Add("acctNbr", [obfuscated]);<BR> conn.Open();<BR> OracleDataReader dr = cmd.ExecuteReader();<BR><BR> blah.DataSource = dr;<BR> blah.DataTextField = "serv_loc_desc";<BR> blah.DataValueField = "serv_loc_id";<BR><BR><BR><BR>Any help would be greatly appreciated!<BR><BR>Mike