private void AddItem2ComboBox(RadComboBoxElement cbb, CSDataRow dr) { DataTable dt = dr.EmbeddedCtlPara.ComBoCtlDataSource; if (cbb.GetType().Equals(typeof(RadComboBoxElement))) { cbb.ValueChanged -= ctlComboBoxElement_ValueChanged; cbb.SelectedIndex = -1; cbb.DataSource = dt; cbb.DisplayMember = dr.EmbeddedCtlPara.DisplayMember; cbb.ValueMember = dr.EmbeddedCtlPara.ValueMember; cbb.ValueChanged += new EventHandler(ctlComboBoxElement_ValueChanged); } else if (cbb.GetType().Equals(typeof(CSCheckComboBoxElement))) { CSCheckComboBoxElement chkcbb = cbb as CSCheckComboBoxElement; chkcbb.Items.Clear(); foreach (DataRow row in dt.Rows) { chkcbb.AddItem(row["LocalName"].ToString()); } } else if (cbb.GetType().Equals(typeof(CSComboBoxExxElement))) { cbb.ValueChanged -= ctlComboBoxExxElement_ValueChanged; cbb.SelectedIndex = -1; cbb.DataSource = dt; cbb.DisplayMember = dr.EmbeddedCtlPara.DisplayMember; cbb.ValueMember = dr.EmbeddedCtlPara.ValueMember; cbb.ValueChanged += ctlComboBoxExxElement_ValueChanged; } }
protected override void CreateChildElements() { base.CreateChildElements(); ctlChk = new RadCheckBoxElement(); ctlChk.ToggleStateChanged += new StateChangedEventHandler(ctlChk_ToggleStateChanged); this.Children.Add(ctlChk); ctlComboBoxElement = new RadComboBoxElement(); ctlComboBoxElement.DropDownStyle = RadDropDownStyle.DropDownList; ctlComboBoxElement.ValueChanged += new EventHandler(ctlComboBoxElement_ValueChanged); this.Children.Add(ctlComboBoxElement); ctlCheckComboBoxElement = new CSCheckComboBoxElement(); ctlCheckComboBoxElement.PopupClosed += new RadPopupClosedEventHandler(ctlCheckComboBoxElement_PopupClosed); this.Children.Add(ctlCheckComboBoxElement); ctlComboBoxExxElement = new CSComboBoxExxElement(); ctlComboBoxExxElement.ValueChanged += new EventHandler(ctlComboBoxExxElement_ValueChanged); this.Children.Add(ctlComboBoxExxElement); ctlTextBox = new RadTextBoxElement(); ctlTextBox.TextChanged += new EventHandler(ctlTextBox_TextChanged); this.Children.Add(ctlTextBox); ctlDataTimePickerElement = new RadDateTimePickerElement(); ctlDataTimePickerElement.ValueChanged += new EventHandler(ctlDataTimePickerElement_ValueChanged); this.Children.Add(ctlDataTimePickerElement); ctlColorSelectorElement = new CSColorSelectorElement(); ctlColorSelectorElement.TextChanged += new EventHandler(ctlColorSelectorElement_TextChanged); this.Children.Add(ctlColorSelectorElement); ctlSpin = new RadSpinElement(); ctlSpin.MinValue = 0; ctlSpin.MaxValue = 100000; ctlSpin.TextChanged += new EventHandler(ctlSpin_TextChanged); this.Children.Add(ctlSpin); ctlNumericTextBox = new CSNumericTextBoxElement(); ctlNumericTextBox.TextChanged += new EventHandler(ctlNumericTextBox_TextChanged); this.Children.Add(ctlNumericTextBox); ctlIntTextBox = new CSIntegerTextBoxElement(); ctlIntTextBox.TextChanged += new EventHandler(ctlIntTextBox_TextChanged); this.Children.Add(ctlIntTextBox); foreach (RadElement element in this.Children) { element.Visibility = ElementVisibility.Collapsed; } }