Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
i am binding countries data in combo box by getting from database table...I need first row of combo box to be "SELECT"
Posted

use this :
C#
ddlCountry.Insert(0,"Please select Category");

or
C#
ddlCountry.Items.Insert(0, new ListItem("-Select-", "0"));

hope this will help you.
And Don't forget to mark as answer if it helps. :)
 
Share this answer
 
v2
Simplest way would be to add a row to your dataset in the sql with a value of "SELECT" and a key of null

e.g.

select null, "SELECT"
union
select countryId, Country from countrytable
 
Share this answer
 
Comments
vijay_jangid 5-May-13 15:49pm    
string strqry = "select '0' as ID,'Select' as Name union select stateid,statename from Master_state";


This is whorking fine....Thanks for hint
use this ..


Form Load()
{
ddlCountry.SelectedIndex = 0;
}
 
Share this answer
 
country.Insert(0,"Select");
or
country.Items.Insert(0, new ListItem("-Select-"));
 
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