insert "Select..." to dropdownlist

How can I insert initial value "Select..." to dropdownlist?
1. Dropdownlist is in Masterpage, contentplaceholder

For each ctrl as control in Form.controls

 DirectCast(ctrl.FindControl("DropDownList" & y), DropDownList).DataSource = Me.SqlDataSource1
 DirectCast(ctrl.FindControl("DropDownList" & y), DropDownList).Items.Insert(0, "Select...")    <<< this does not help
 DirectCast(ctrl.FindControl("DropDownList" & y), DropDownList).DataTextField = "columnname"
 DirectCast(ctrl.FindControl("DropDownList" & y), DropDownList).DataBind()

Who is Participating?
Paul JacksonConnect With a Mentor Software EngineerCommented:

Set the AppendDataBoundItems attribute to true and add the default listitem in the aspx :

<asp:DropDownList id="list" runat="server" DataSourceID="dataSource" DataTextField="Name" DataValueField="id" AppendDataBoundItems="true" ><asp:ListItem Text="Select..." Value=0 /></asp:DropDownListItem>

dejaanbuConnect With a Mentor Commented:
another way is,

after assigning datasource and calling Databind, add this line

Dropdownlist.Items.Insert(0, New ListItem("<<--Select-->>", ""))
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.