Solved

asp .net dropdown list check

Posted on 2008-10-30
4
577 Views
Last Modified: 2013-12-17
I have a dropdown list and would like to know in the code behind if any item is selected from this dropdown list. If nothing is selected, I will be using a database value. How do I check that? Thanks,

c#, asp.net
0
Comment
Question by:rajeevcs
4 Comments
 
LVL 4

Accepted Solution

by:
sijishJohn earned 250 total points
Comment Utility
try this..

if (DropDownList1.SelectedItem == null)
{

}
0
 

Assisted Solution

by:dhiraj79
dhiraj79 earned 250 total points
Comment Utility
Add First Item as --Select-- in drop down list of Items by using edit Item  

Now check for
if (DropDownList1.SelectedValue == "--Select--")
{
 // Means nothing is selected.
}
else
{
//Something is selected.
}
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 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

8 Experts available now in Live!

Get 1:1 Help Now