Set Dropdown List Default Text

  • Thread starter Thread starter Kenneth Keeley
  • Start date Start date
K

Kenneth Keeley

Hi,
Is it possible to have a dropdown list that when the page is first
visited has a selected value of something like "Choose an Option". After the
user has selected an option the the user should not be able to selected the
default value an more. If this is possible could somebody show me a same in
C#.

Thanks
Kenneth
 
There are several ways to do that. One would be the SelectedIndexChanged
event. When the event occurs, check the value of the selected item. If it is
the text you don't want selected, remove that item. However, I would suggest
using a validator. The two best candidates would be the
RequiredFieldValidator and the CompareValidator.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top