Hi,
I have a combobox of countries which I loaded in collections property. When I select a country I want the details to be displayed on a gridview but when I select nothing gets returned back to me..I hope this makes sense. I havent set the selectedIndex to anything plz help anyone,Thanks.
Loading

Prabhu RajaRank #861 · 2.6K reputationPosted Oct 10, 2011, 2:27 AM EDT
I can't understand, "gets returned back to me" in your post. but i suggest you, select a item by default when form gets loaded.
Example:
In form_Load() Event,
If ( this.combobox1.items.Count >0) then
this.combobox1.selectedIndex = 0;
TulasiRank #2,544 · 549 reputationPosted Oct 10, 2011, 2:30 AM EDT
1)make sure ur combobox will be binded in the following way
protected void Page_load(Object sender,EventArgs e)
{
if(!IsPoatback)
{
//write code to bind combobx
}
}
2) write the following code in SelectedindexChangedEvent
if (drp.SelectedItem.Text!="Select")
{
//code to bind information to gridview
}
else
{
//dispaly message no country is selected
}
Please do not forget to mark "Accpeted Answer".
Avuya MxoliRank #7,940 · 231 reputationPosted Oct 10, 2011, 2:35 AM EDT
Avuya MxoliRank #7,940 · 231 reputationPosted Oct 10, 2011, 3:01 AM EDT
Prabhu RajaRank #861 · 2.6K reputationPosted Oct 10, 2011, 3:12 AM EDT