c# - How will you keep a specific country on top in a drop down list? -


in list of countries need displayed in alphabetical order, need place united states @ top of list. how this?

i answered saying have table structure in such way @ id-0. rest of countries listed in alphabetical order.

so when fetch table, "select countryname tableofcountries order id"

i not sure if interviewer wanted hear this. suggested option of populating country array first element. rest of elements populated resultset of query.

"select countryname tableofcountries countryname != 'us' order country_name". 

this ensure not selected twice.

the interviewer wasn't satisfied option either. asked me if had other option in mind. said text file on webserver list of values.

do have other options can think of?

generally like:

select      countryname   tableofcountries   order      (case when countryname = 'us' 0       else 1 end) asc, countryname asc 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -