I want to create a Drop Down using Aspx, which will list all the items contained in a data source but it will have an additional default value of “selected”.
In the aspx file, I have:
<aspx:DropDownList
ID="ddl1"
runat="server"/>
In my aspx.cs file, I have a page_load, which contains:
protected void Page_Load(object sender, EventArgs e)
{
ddl1.DataSource = LocationofData;
ddl1.DataBind();
}
And let’s assume that LocationofData will populate the values “a,b,c,etc…”. I want the default value to be “–selected–“
How should I approach this?
Thanks
Try this