【问题标题】:Update panel not working in two asp panel更新面板在两个 asp 面板中不起作用
【发布时间】:2015-02-25 18:12:47
【问题描述】:

在我的 ascx 页面中,我有两个面板,我试图在更新面板中更改这些面板。但是每次单击单选按钮时页面加载都会进行。这是我的代码

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

点击页面重新加载的每个单选按钮。我们怎样才能克服这个问题。 提前感谢您的帮助。

【问题讨论】:

  • 从您的单选按钮中删除 Autopostback="True"
  • @CoderofCode 我删除了自动回发。但它不起作用...

标签: c# asp.net updatepanel


【解决方案1】:

我希望这会有所帮助。请检查此链接

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

【讨论】:

  • 嗨 Veena,Ithu nokkiyatha 但是 kittunnilla .... :) 我需要通过单击单选按钮来更改面板的可见性。
  • 那么,你需要根据单选按钮索引的变化来改变 panel1 的可见性吗?
  • 我刚刚完成了 panel2.visible=false;面板1.可见=真;在单选按钮内选择 indexchange
  • 请张贴在这里
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-11-27
  • 2014-07-30
  • 2017-01-31
  • 2010-10-13
  • 2011-11-07
  • 2010-10-17
相关资源
最近更新 更多