Reputation: 57
I have two dropdowns, dependent upon each other selection. Now what I want is to reload both dropdown, when user clicks on first item, i.e, index 0.
onchange event is already associated with the dropdowns, so selectedindexchanged event is not being called.
What else can be done in this scenario?
Upvotes: 0
Views: 67
Reputation:
'so selectedindexchanged event is not being called.'
In the properties for your combobox, set 'AutoPostBack' to true and this event will now be called.
Sorry; had to make an edit - I meant true not false.
Edit:
OnChange event is associated with my dropdown, and now am trying to add selectedindex changed event. Is it possible?
Yes, controls can have many events attached to it.
Code which works for selectedindex :
protected void Page_Load(object sender, EventArgs e)
{
for (int i = 1; i < 10; i++)
{
DropDownList1.Items.Add(i.ToString());
}
DropDownList1.AutoPostBack = true;
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
}
Upvotes: 2