Prepend text “Select Value” to a databound dropdown list c#

You have a dropdown list, populated via sql data source, and you want it to have “Select a value” as the first selected option.

protected void DropDownList2_DataBound(object sender, EventArgs e)
        {
            DropDownList list = sender as DropDownList;
            if(list != null)
            {
                list.Items.Insert(0, "--Select Date--");
            }
        }

Leave a Reply