Click here to Skip to main content
15,884,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a column name is Country_nm in table like

China
India
USA
JAPAN


I want to show these country_nm in dropdownlist control but I want to show India as the name in dropdownlist and then others will be shown usin select query
like
India,
China,
Japan,
USA


Please help me...
Posted
Comments
choudhary.sumit 5-Dec-12 1:28am    
insert india at 0 index of the dropdown. dont fetch it from database..
n_sriganesh 5-Dec-12 2:17am    
Do you have any columnid or any other column associated with this column.for e.g
countryid country_nm
1 china
2 usa
etc etc

Add a sort column to your data source with India in position 0
or
Manually insert India to your list and then do all the other countries in your data source remembering no to process India twice.
 
Share this answer
 
Try this....

ASP.NET
<asp:listitem text="India" value="0" xmlns:asp="#unknown">
<asp:listitem text="Usa" value="1">
<asp:listitem text="china" value="2">
<asp:listitem text="japan" value="3">


or

in code behind

C#
ddl_country.items.insert(0,"India");

ddl_country.items.insert(1,"japan");


.......
HTML
</asp:listitem></asp:listitem></asp:listitem></asp:listitem>
 
Share this answer
 
v2
select * from country_lst_tab
order by case when Country_nm='India' then 0 else 1 end, country_nm
 
Share this answer
 
Comments
Archana Parate 29-Jan-13 5:44am    
Thank You...
you can use selectedindex/selectedItem property of listbox/dropdown to set default selected value.
 
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