sql query
hi I have country dropdownlist I am binding it from database I want to display india first is it possible to with sql query
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Praneet RanePosted Nov 29, 2013, 12:26 AM
HanookPosted Nov 21, 2013, 1:25 AM
SELECT *
FROM country
ORDER BY CASE WHEN CoutryName = 'India' THEN 1 ELSE 2 END
Girish SapariyaPosted Nov 21, 2013, 1:17 AM
Jignesh TrivediPosted Nov 20, 2013, 11:25 PM
hi,
I think if you have knowledge about value of Id field of India" than you can use selectedIndex property to select any value from drop down list.
dropDownList1.SelectedIndex = 5;
Please refer
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.dropdownlist.selectedindex%28v=vs.110%29.aspx
hope this will help you.
Jaganathan BantheswaranPosted Nov 20, 2013, 7:37 AM
If you are using C#,
ddl.Items.Insert(0, itemtobeinserted);