/// <summary> /// Picks adapter and calls its createchildcontrols method. /// </summary> protected override void CreateChildControls() { _adapter = SelectPicklistAdapter(); _adapter.CreateChildControls(this); if (this.Page is EntityPage && ((EntityPage)this.Page).IsNewEntity) { ViewState.Remove("Text"); } else { _adapter.SetValue((String)ViewState["Text"]); } _adapter.TextChanged += delegate { if (TextChanged != null && (String)ViewState["Text"] != _adapter.GetValue()) { ViewState["Text"] = _adapter.GetValue(); TextChanged(this, EventArgs.Empty); } }; }