I have a listbox of countries populated from a datasource and sorted by country name.
I would like to have my two mostly used countries, the "US" and "Canada" at the top of the list.
Is there an easy way to do this.
Thanks,
Pierre
Printable View
I have a listbox of countries populated from a datasource and sorted by country name.
I would like to have my two mostly used countries, the "US" and "Canada" at the top of the list.
Is there an easy way to do this.
Thanks,
Pierre
In the table, add one more column - say priority. Set it to 2 for US, 1 for canada, and 0 for all others.
Sort by priority and then by name!
That's work fine, was still hoping to find a way to do it within the list box without changing the table.
Then code it yourself! Append US and Canada as first two entries, and retrieve other countries from table. But in that case you would lose automatic data binding.
Yes, as Ajay alludes to you can create your own Comparer class that can selectively push those two entries to the top and sort the rest by alphabet or however you like.