Solved

asp .net dropdown list check

Posted on 2008-10-30
4
582 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
ID: 22839658
try this..

if (DropDownList1.SelectedItem == null)
{

}
0
 

Assisted Solution

by:dhiraj79
dhiraj79 earned 250 total points
ID: 22842315
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

772 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