Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to make dropdownlist selected text as "--Select--"
Posted

Write given code on page_Load

C#
DropDownList1.Items.Add("--Select--");
 
Share this answer
 
v2
Comments
ridoy 18-Mar-13 13:05pm    
+5
I always use a UNION in my query.
E.g.
select 0, "--select--"
UNION
select dataId,dataName from myTable
 
Share this answer
 
Comments
CHill60 18-Mar-13 13:27pm    
My +5 as you can then use Binding (if you want to)
Try something like this...

C#
comboBox1.Items.Add("--Select--");
comboBox1.SelectedItem = "--Select--";


B
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900