public void DataBindTemplate(object sender, EventArgs e) { PlaceHolder templatePlaceHolder = sender as PlaceHolder; DetailsViewRow row = templatePlaceHolder.Parent.Parent as DetailsViewRow; SuperForm form = row.Parent.Parent as SuperForm; Obout.ComboBox.ComboBox comboBox = templatePlaceHolder.Controls[0] as Obout.ComboBox.ComboBox; comboBox.SelectedValue = DataBinder.Eval(form.DataItem, "ShipCountry").ToString(); }
public void CreateEditCountryTemplate(Object sender, Obout.Grid.GridRuntimeTemplateEventArgs e) { PlaceHolder oPlaceHolder = new PlaceHolder(); e.Container.Controls.Add(oPlaceHolder); Obout.ComboBox.ComboBox ComboBox1 = new Obout.ComboBox.ComboBox(); ComboBox1.ID = "ComboBox1"; ComboBox1.Height = 100; ComboBox1.Width = Unit.Percentage(100); ComboBox1.DataSourceID = "SqlDataSource2"; ComboBox1.DataTextField = "CountryName"; ComboBox1.AppendDataBoundItems = false; ComboBox1.DataValueField = "CountryName"; oPlaceHolder.Controls.Add(ComboBox1); }
public void InstantiateIn(Control container) { PlaceHolder templatePlaceHolder = new PlaceHolder(); container.Controls.Add(templatePlaceHolder); Obout.ComboBox.ComboBox comboBox = new Obout.ComboBox.ComboBox(); templatePlaceHolder.Controls.Add(comboBox); comboBox.ID = "ShipCountry"; comboBox.DataSourceID = "SqlDataSource2"; comboBox.Height = Unit.Pixel(150); comboBox.Width = Unit.Percentage(100); comboBox.DataValueField = "ShipCountry"; comboBox.DataTextField = "ShipCountry"; templatePlaceHolder.DataBinding += new EventHandler(DataBindTemplate); }