i want 2 show dropdown on my web page with zero index fixed [select option]
as soon as user select items from a dropdown i want to do some code behind
on that index but dropdown zeroth index should remain intact
how can i achieve this?
Fixed zeroth index in dropdown [asp.net]
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Manoj SevdaRank #1,670 · 916 reputationPosted Nov 21, 2011, 6:39 PM EST
use following code.
if(ds.Tables[0].Rows.Count>0)
{
ddlTest.Items.Clear();
ddlTest.Items.Add(new ListItem("--Select--", "0"));
foreeach(DataRow dr in ds.Tables[0].Rows)
{
ddlTest.Items.Add(new ListItem(dr["Name"].ToString(), dr["id"].ToString()));
}
}