Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends,

I have one dropdownlist, like

<asp:DropDownList ID="ddlCourse" runat="server">
<asp:ListItem >Select your Course
<asp:ListItem >C
<asp:ListItem >C++
<asp:ListItem >C#
<asp:ListItem >ASP.Net
<asp:ListItem >SQL Server


Now I don't want to visible select Your Course in dropdownlist items, but I need the default value is Select your Course only.

Thank you.
Posted

ddlCourse.Items.Insert(0, "Select your Course");
 
Share this answer
 
Comments
Member 10021658 28-Aug-14 5:41am    
Thanks for your reply.

But I don't to display in listitems, whenever try to click the dropdownlist it will shows the fisrt value is 'C' only, like watermark.
Sanchayeeta 28-Aug-14 5:58am    
I don't think it is possible. but may be you can search in jquery for watermark in dropdown.
Use selected index for dropdown list

C#
ddlCourse.SelectedIndex = 1//for C by default selection


Expand
DropDownList.SelectedIndex Property
 
Share this answer
 
v2
Here is a method:
C#
ddlCourse.Items.Insert(0, new ListItem("Select your Course","0"));
 
Share this answer
 

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