I have a webform containing a user control. On that user control is a set of radio buttons. When the radio button is changed, a panel and a text box is shown or hidden depending on which radio button was selected.
I can give you an example that works correctly:
testcontrol.aspx:
<asp:RadioButtonList ID="ChoicesRadioButtonList" AutoPostBack="true" OnSelectedIndexChanged="ChoicesRadioButtonList_SelectedIndexChanged" runat="server">
<asp:ListItem Text="Show 1"></asp:ListItem>
<asp:ListItem Text="Show 2"></asp:ListItem>
</asp:RadioButtonList>
<asp:Panel id="Panel1" CssClass="panel1" runat="server"></asp:Panel>
<asp:Panel id="Panel2" CssClass="panel2" runat="server"></asp:Panel>
testcontrol.aspx.cs:
protected void ChoicesRadioButtonList_SelectedIndexChanged(object sender, EventArgs e)
{
RadioButtonList bob = (RadioButtonList)sender;
switch (bob.SelectedValue)
{
case "Show 1":
Panel1.Visible = true;
Panel2.Visible = false;
break;
case "Show 2":
Panel1.Visible = false;
Panel2.Visible = true;
break;
}
}
As I mentioned, in a test form this works properly. Panel1 and Panel2 are displayed correctly based on which radio button is selected.
I have another web page and user control with a number of other fields. When this code is on that page, I can step through the code behind for the ChoicesRadioButtonList_SelectedIndexChanged event, but nothing happens.
I am at a loss for next steps to debug this (short of rebuilding the entire page from scratch). Can anyone offer any suggestions on where to look?