Solved

empty field in dropdown

Posted on 2006-06-27
2
186 Views
Last Modified: 2010-04-16
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
0
Comment
Question by:watherton
2 Comments
 

Accepted Solution

by:
laurens76 earned 50 total points
Comment Utility
I solved this by putting the following line after the dd.DataBind():

dd.Items.Insert(0, "Please select");
0
 

Author Comment

by:watherton
Comment Utility
great stuff lauren
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now