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 RajaPosted Oct 10, 2011, 7:12 AM
Avuya MxoliPosted Oct 10, 2011, 7:01 AM
Avuya MxoliPosted Oct 10, 2011, 6:35 AM
TulasiPosted Oct 10, 2011, 6:30 AM
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".
Prabhu RajaPosted Oct 10, 2011, 6:27 AM
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;