I have 2 RadioButtonLists and I want only one option to be selected, f.i. if you select an option in List 1 the selection in List 2 should be cleared.
AutoPostBack and EnableViewState is set to true, but still the Method never fires. I have also checked if the Index actually changes, it does. I think that the PostBack just doesn't occur, but I don'T know why.
I'm thankful for any help.
ascx:
<asp:RadioButtonList ID="_listOne" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ListOneIndexChanged">
</asp:RadioButtonList>
<asp:RadioButtonList ID="_listTwo" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ListTwoIndexChanged">
</asp:RadioButtonList>
Code Behind:
protected void ListOneIndexChanged(object sender, EventArgs e)
{
_listTwo.ClearSelection();
}
protected void ListTwoIndexChanged(object sender, EventArgs e)
{
_listOne.ClearSelection();
}
"I think that the PostBack just doesn't occur"
- Have you verified this? The browser's debugging tools will tell you if a request is made, what the response is, if there are any client-side errors, etc. Does anything happen in thePage_Load
event during the post-back which stops this? Maybe the lists are re-populated in that method and the selection changed event is lost? You need to debug this a little. – David