empty field in dropdown

Hi guys,

need to know how I create an empty or 'Please select' entry in a drop down list that is populated from a dataset.

I have the following, but it does not seem to work

dd.Items.Add("Please select");
dd.DataSource = dataset;
dd.DataTextField = "Code";
dd.DataValueField =   "Value";
dd.DataBind();

Cheers

Wayne
wathertonAsked:
Who is Participating?
 
laurens76Connect With a Mentor Commented:
I solved this by putting the following line after the dd.DataBind():

dd.Items.Insert(0, "Please select");
0
 
wathertonAuthor Commented:
great stuff lauren
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.