Click here to Skip to main content
Sign Up to vote bad
good
See more: ASP.NETSQLVB.NET
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 4 Dec '12 - 19:23

Comments
choudhary.sumit - 5 Dec '12 - 1:28
insert india at 0 index of the dropdown. dont fetch it from database..
n_sriganesh - 5 Dec '12 - 2:17
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

4 solutions

select * from country_lst_tab
order by case when Country_nm='India' then 0 else 1 end, country_nm
  Permalink  
Comments
Archana Parate - 29 Jan '13 - 5:44
Thank You...
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.
  Permalink  
Try this....
 
<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
 
ddl_country.items.insert(0,"India");
 
ddl_country.items.insert(1,"japan");
 
.......
</asp:listitem></asp:listitem></asp:listitem></asp:listitem>
  Permalink  
you can use selectedindex/selectedItem property of listbox/dropdown to set default selected value.
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 419
1 Mahesh Bailwal 303
2 CPallini 245
3 Maciej Los 240
4 Aarti Meswania 173
0 Sergey Alexandrovich Kryukov 9,162
1 OriginalGriff 7,179
2 CPallini 3,913
3 Rohan Leuva 3,176
4 Maciej Los 2,588


Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 5 Dec 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid