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.ListBox.ListBox listBox = templatePlaceHolder.Controls[0] as Obout.ListBox.ListBox; listBox.SelectedValue = DataBinder.Eval(form.DataItem, "ShipCountry").ToString(); }
protected void Page_Load(object sender, EventArgs e) { ListBox1 = new Obout.ListBox.ListBox(); ListBox1.ID = "ListBox1"; ListBox1.Width = Unit.Pixel(250); ListBox1.DataSourceID = "sds1"; ListBox1.DataTextField = "CompanyName"; ListBox1.DataValueField = "CustomerID"; ListBox1.SelectedIndex = 4; ListBox1Container.Controls.Add(ListBox1); }
public void InstantiateIn(Control container) { PlaceHolder templatePlaceHolder = new PlaceHolder(); container.Controls.Add(templatePlaceHolder); Obout.ListBox.ListBox listBox = new Obout.ListBox.ListBox(); templatePlaceHolder.Controls.Add(listBox); listBox.ID = "ShipCountry"; listBox.DataSourceID = "SqlDataSource2"; listBox.Height = Unit.Pixel(150); listBox.DataValueField = "ShipCountry"; listBox.DataTextField = "ShipCountry"; templatePlaceHolder.DataBinding += new EventHandler(DataBindTemplate); }
public void InstantiateIn(Control container) { PlaceHolder templatePlaceHolder = new PlaceHolder(); container.Controls.Add(templatePlaceHolder); Obout.ListBox.ListBox listBox1 = new Obout.ListBox.ListBox(); templatePlaceHolder.Controls.Add(listBox1); listBox1.ID = "ShipCountry"; listBox1.DataSourceID = "SqlDataSource2"; listBox1.Width = Unit.Percentage(100); listBox1.Height = Unit.Pixel(150); listBox1.DataValueField = "ShipCountry"; listBox1.DataTextField = "ShipCountry"; templatePlaceHolder.DataBinding += new EventHandler(DataBindTemplate); }