weird situation with autopostback
-
Hey all, I have a DropDownList control in my page. I set the AutoPostBack property to true and also created the SelectedIndexChanged event method. Everytime I change the index it supposes to call the SelectedIndexChanged event but it only call it when index is not zero :mad: With the use of debugger and breakpoint at this method I realized that when the dropDownList's SelectedIndex is not zero - the event is raized but when the index is zero it ignores the event Please help :sigh: RoyRose
-
Hey all, I have a DropDownList control in my page. I set the AutoPostBack property to true and also created the SelectedIndexChanged event method. Everytime I change the index it supposes to call the SelectedIndexChanged event but it only call it when index is not zero :mad: With the use of debugger and breakpoint at this method I realized that when the dropDownList's SelectedIndex is not zero - the event is raized but when the index is zero it ignores the event Please help :sigh: RoyRose
I have another comment.. The problem was with index 0 I realizes that when I set the item in index 1 to selected = true the event not fired to it!
<asp:DropDownList ID="_TableDropDownList" ... OnSelectedIndexChanged="_TableDropDownList_SelectedIndexChanged"> <asp:ListItem>cities</asp:ListItem> <asp:ListItem Selected="**True**">courses</asp:ListItem> </asp:DropDownList>
I set all items with Selected="False" but still when I choose the item in index zero it won't fire the event.. -
I have another comment.. The problem was with index 0 I realizes that when I set the item in index 1 to selected = true the event not fired to it!
<asp:DropDownList ID="_TableDropDownList" ... OnSelectedIndexChanged="_TableDropDownList_SelectedIndexChanged"> <asp:ListItem>cities</asp:ListItem> <asp:ListItem Selected="**True**">courses</asp:ListItem> </asp:DropDownList>
I set all items with Selected="False" but still when I choose the item in index zero it won't fire the event.. -
Youn can find one solution for that you can add some other listitem in place of listitem at 0 index as select or please select one or select one, or 0th index item you keep it nothing like cities
I'm king of lost here... this situation is very weird because the event is not fired when I select the first item in my drop down list..! Let me tell you the exact problem: I have a user control with a drop down list control. This control is auto post back to server when index is changed. When I select the second(or third, forth etc) item - the event method _TableDropDownList_SelectedIndexChanged is being called. When I select the first item this event isn't fired - so _TableDropDownList_SelectedIndexChanged is not being called! I use breakpoints in this event method and also in page_load method and I can say that page_load is happend but _TableDropDownList_SelectedIndexChanged isn't. it just ignores it somehow when I select the first item... Someone please :(( RoyRose