How to use DropDownList with C#.NET
-
Hi all, I want to use a DropDownList control and set this property In Page_Load event: ddl.DataTextField="Adminicle"; ddl.DataValueField="CodeAdminicle"; ddl.DataBind(); In SelectedIndexChanged event: row=ddl.SelectedItem.Value but no row was selected. what should i do?
-
Hi all, I want to use a DropDownList control and set this property In Page_Load event: ddl.DataTextField="Adminicle"; ddl.DataValueField="CodeAdminicle"; ddl.DataBind(); In SelectedIndexChanged event: row=ddl.SelectedItem.Value but no row was selected. what should i do?
Set 0 index value as default after the bind. Please be ensue list should be 1 value.
Parwej Ahamad g.parwez@gmail.com
-
Hi all, I want to use a DropDownList control and set this property In Page_Load event: ddl.DataTextField="Adminicle"; ddl.DataValueField="CodeAdminicle"; ddl.DataBind(); In SelectedIndexChanged event: row=ddl.SelectedItem.Value but no row was selected. what should i do?
This is example, //This is one way to u should bind to dropdown with list. foreach(string text in TextList) { dropdown.Item.Add(new ListItem(text.Name.ToString(),text.ID.ToString())); } //when u select value from dropdown,in the selectedIndexChanged Event string value=dropdown.SelectedValue.ToString(); may be this will help u.