Click here to Skip to main content
12,697,801 members (25,837 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB ASP.NET SQL VB.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 20:23pm
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
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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  
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

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:44am
   
Thank You...
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

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
Top Experts
Last 24hrsThis month


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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100