更新面板在两个 asp 面板中不起作用

Update panel not working in two asp panel

在我的 ascx 页面中,我有两个面板,我试图在更新中更改这些面板 panel.but 每次点击收音机都会加载页面 button.here 是我的代码

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>


<asp:UpdatePanel ID="UpdatePanel1" runat="server">

<ContentTemplate>
<asp:Panel ID="Panel2" runat="server" >
<asp:RadioButtonList runat="server" ID="radioListAnswers"  RepeatDirection="Horizontal" AutoPostBack="true" ClientIDMode="Static" onselectedindexchanged="radioListAnswers_SelectedIndexChanged">
        </asp:RadioButtonList>
</asp:Panel>

</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="radioListAnswers" EventName="SelectedIndexChanged"/>
</Triggers>
<ContentTemplate>

<asp:Panel ID="Panel1" runat="server" Visible="false">
<div> Thanks</div>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>

下面是我的代码

void radioListAnswers_SelectedIndexChanged(object sender, EventArgs e)
    {
        panel2.Visible=false;
panel1.Visible=true;
    }

单击每个单选按钮后页面是 reloading.How 我们可以过来吗? 在此先感谢您的帮助。

希望对您有所帮助。请检查此 link

https://msdn.microsoft.com/en-us/library/bb398867(v=vs.140).aspx