protected void Page_Load(object sender, EventArgs e)
{
//set a data source to bind to
this.webDropDown1.DataSource = this.GetGridData();
//Set which column to display in the input upon selection
this.webDropDown1.TextField = "Name";
//Set the current value
this.webDropDown1.CurrentValue = "Select a Contact";
this.webDropDown1.EnableAnimations = false;
this.webDropDown1.DropDownContainerHeight = 135;
this.webDropDown1.DropDownContainerWidth = 480;
}
//generate a table to be used as data source
private DataTable GetGridData()
{
DataTable DS = new DataTable("TestData");
DataColumn col = DS.Columns.Add("ID", typeof(int));
DS.Columns.Add("Name", typeof(string));
DS.Columns.Add("Company", typeof(string));
DS.Columns.Add("PostalCode", typeof(string));
DS.PrimaryKey = new DataColumn[] { col };
DS.Rows.Add(new Object[] { 1, "Maria Anders", "Alfreds Futterkiste", "12209" });
DS.Rows.Add(new Object[] { 2, "Antonio Moreno", "Antonio Moreno Taqueria", "05023" });
DS.Rows.Add(new Object[] { 3, "Thomas Hardy", "Around the Horn", "WA1 1DP" });
DS.Rows.Add(new Object[] { 4, "Hanna Moos", "Blauer See Deilikatessen", "68306" });
return DS;
}