在UpdatePanel的一个UserControl里面按钮触发回传 [英] Postback trigger for button inside a usercontrol in Updatepanel

查看:273
本文介绍了在UpdatePanel的一个UserControl里面按钮触发回传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我把一个更新面板,也就是像这里面的用户控件。

I have a user control placed inside an update panel, ie like this.

<asp:UpdatePanel ID="testupdatepnl" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
                        <uc1:TestControl ID="ctlTest" runat="server" />
        </ContentTemplate>
</asp:UpdatePanel>

现在我得到了放在这个用户控件说里面点击一个按钮。我想回发按钮点击整个页面。
我尝试添加回发触发器像这样

Now i got a button placed inside this user control say Click. I want to postback the whole page on the button click. I tried to add a postback trigger like this

<Triggers>
    <asp:PostBackTrigger ControlID="clickButton" />
</Triggers>

由于按钮是用户控件里面,我跑这样而得到错误。

Since the button is inside the usercontrol , i got error while running like this.

有没有办法做一个回发此按钮。

Is there any way to do a postback for this button.

推荐答案

删除&LT;&触发器GT; 从HTML&安培;这种加入 pageLoad的事件

Remove the <Triggers> from HTML & Add this to PageLoad event

ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page);
scriptManager.RegisterPostBackControl(WebUserControl11.FindControl("ButtonId")); 

注意:从<有学问href=\"http://www.dotnetspider.com/resources/29004-A-control-with-ID-button-could-not-be-found.aspx\">this

这篇关于在UpdatePanel的一个UserControl里面按钮触发回传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆