简体   繁体   中英

Update panel not working in two asp panel

In my ascx page I have two panel,I trying to change these panels inside an update panel.but the page load is going on each click on radio button.here is my code

<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>

here is my code behind

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

on click on each radio button the page is reloading.How can we over come this. Thanks in advance for help.

i hope this will help. Pls check this link

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM