First item in dropDownList blank

Hi,

Usually when a DropDownlist is populated by items retrieved from a database the first item in the list shows in the List's textbox.

My Question is how to make that textbox blank, so that the items in the list only show when when we open it.

Thanks


adamtraskAsked:
Who is Participating?
 
Kumaraswamy RConnect With a Mentor Commented:
Hi

After your databinding ,add fellow coding

dataListctrl.Items.Insert(0, new ListItem(String.Empty, String.Empty));
dataListctrl.SelectedIndex = 0;
0
 
Dale BurrellDirectorCommented:
You manually add a ListItem with blank text. You can add it in the HTML section<asp:ListItem> etc and then set the appenddataitems to true in the dropdownlist.
0
 
adamtraskAuthor Commented:
Thanks a lot
0
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.