ModalPopupExtender确定按钮单击事件不触发? [英] ModalPopupExtender OK Button click event not firing?

查看:193
本文介绍了ModalPopupExtender确定按钮单击事件不触发?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UpdatePanel内的按钮。按钮被用作ModalPopupExtender OK按钮。出于某种原因,该按钮单击事件不点火。有任何想法吗?我缺少的东西吗?

 < ASP:的UpdatePanel ID =UpdatePanel1=服务器>
<&的ContentTemplate GT;
        < CC1:ModalPopupExtender ID =ModalDialog=服务器
            的TargetControlID =OpenDialogLinkBut​​ton
PopupControlID =ModalDialogPanelOkControlID =ModalOKButton
BackgroundCssClass =ModalBackground>
< / CC1:ModalPopupExtender>
< ASP:面板ID =ModalDialogPanel的CssClass =ModalPopup=服务器>
...
< ASP:按钮的ID =ModalOKButton=服务器文本=OK
                        的onclick =ModalOKButton_Click/>
< / ASP:面板>
< /&的ContentTemplate GT;
< / ASP:的UpdatePanel>


解决方案

.aspx的

 < AJAX:ModalPopupExtender =服务器ID =modalPop
            PopupControlID =pnlpopup
            的TargetControlID =btnGo
              BackgroundCssClass =modalBackground
             阴影效果=真
             CancelControlID =btnCancelX =470Y =300/>
// codebehind
保护无效OkButton_Clicked(对象发件人,EventArgs的发送)
    {        modalPop.Hide();
        //不要在codebehind东西
    }

不要设置OK按钮OkControlID。

I have a Button inside an UpdatePanel. The button is being used as the OK button for a ModalPopupExtender. For some reason, the button click event is not firing. Any ideas? Am I missing something?

<asp:updatepanel id="UpdatePanel1" runat="server">
	<ContentTemplate>
        <cc1:ModalPopupExtender ID="ModalDialog" runat="server" 
            TargetControlID="OpenDialogLinkButton"
			PopupControlID="ModalDialogPanel" OkControlID="ModalOKButton"
			BackgroundCssClass="ModalBackground">
		</cc1:ModalPopupExtender>
		<asp:Panel ID="ModalDialogPanel" CssClass="ModalPopup" runat="server">
			...
			<asp:Button ID="ModalOKButton" runat="server" Text="OK" 
                        onclick="ModalOKButton_Click" />
		</asp:Panel>
	</ContentTemplate>
</asp:updatepanel>

解决方案

Aspx

<ajax:ModalPopupExtender runat="server" ID="modalPop" 
            PopupControlID="pnlpopup" 
            TargetControlID="btnGo"
              BackgroundCssClass="modalBackground"
             DropShadow="true"
             CancelControlID="btnCancel" X="470" Y="300"   />


//Codebehind    
protected void OkButton_Clicked(object sender, EventArgs e)
    {

        modalPop.Hide();
        //Do something in codebehind
    }

And don't set the OK button as OkControlID.

这篇关于ModalPopupExtender确定按钮单击事件不触发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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