0

我需要将按钮保留在用户控件(.ascx)文件中。我已经为同一个按钮提供了 AsyncPostBackTrigger controlid。但在 UpdatePanel 中找不到触发器显示“错误”。任何人都可以帮助我吗?这个我给了controlid

    <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">



    <ContentTemplate>

   <asp:Panel ID="pnlYourAccount" runat="server" Style="display: none; height: 100%;
      margin-left: 330px; margin-top: -230px;">

   here is my design

   </asp:Panel>

   </<ContentTemplate>

   </asp:UpdatePanel>

`

<Triggers>

<asp:AsyncPostBackTrigger ControlID="btn1" EventName="Click" />

</Triggers>

`

这个链接按钮我保存在用户控件中(用于顶部菜单)。当点击菜单时,内容应该得到更新

<asp:LinkButton class="anchorstyle" ID="btn1" runat="server" Text="MenuName" />
4

1 回答 1

0

在 aspx 页面中

<asp:LinkButton class="anchorstyle" ID="btn1" runat="server" Text="MenuName" OnClick="btn1_Click" />

在 aspx.cs 页面中添加此事件

protected void btn1_Click(object sender, EventArgs e)
{
   //write your code here
}

然后它工作正常。

于 2013-08-31T09:32:29.987 回答