2013-08-31 37 views
0

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

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

`

这个LinkBut​​ton的我一直在用户控件(顶级菜单)。而菜单上单击内容应该得到aspx页面

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

在aspx.cs页面更新

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

请显示一些代码。 –

+0

请指定一些代码 –

+0

请在这里发布您的代码。 – Roshe

回答

0

添加此事件

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

那么它的正常工作。

+0

是的,我已经从aspx页面中删除触发器现在添加通过aspx.cs页面 – tgranjith

+0

我如何在aspx中访问用户控件的控件(Linkbutton) – tgranjith

+0

那么你有什么问题? –

相关问题