Home > ASP.Net > Adding Default Select Option in the DroDownList

Adding Default Select Option in the DroDownList


Hi

try the following ways :-

<asp:DropDownList ID="DropDownList1" runat="server" AppendDataBoundItems="true">
    <asp:ListItem Value="-1">Select</asp:ListItem>
</asp:DropDownList>

//—– another way

DropDownList1.AppendDataBoundItems = true;
DropDownList1.Items.Add(new ListItem("Select", "-1"));
//Bind Your DropDownList here with data from database

//—– another way

//Bind Your DropDownList here with data from database
DropDownList1.Items.Insert(0, new ListItem("Select", "-1"));

Hope this helps

Good Luck

Advertisements
Categories: ASP.Net
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: