.Show后模式弹出扩展自动关闭() [英] Modal Popup Extender auto closing after .Show()

查看:130
本文介绍了.Show后模式弹出扩展自动关闭()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ModalPopupExtender从AjaxToolkit的asp.net。我想有不同的按钮触发一个ModalPopupExtender。问题是,除非我正在使用的TargetControlID弹出打开并迅速在一秒钟之内关闭。我需要这个弹出可以访问 通过与面板相同的几个不同的按钮使用每次。

I am using ModalPopupExtender from AjaxToolkit for asp.net. I am trying to have a ModalPopupExtender triggered with different buttons. The problem is that unless I am using the TargetControlID the popup opens and quickly closes within under a second. I need this popup to be accessible by several different buttons with the same panel being used everytime.

在code以下应该复制的问题很好,在我的实际应用中几乎正常工作。即使内容进行更新的弹出窗口的选择面板不同的是,当我调用.show()从的OnClientClick约1/2秒后关闭;

The code below should replicate the problem nicely, on my actual application it almost works fine. Even content being updated with the chosen panel of the popup except that it closes after about 1/2 sec when i call .show() from OnClientClick;

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Untitled Page</title>
<script language="javascript" type="text/javascript">
    //Function to Hide ModalPopUp
    function Hidepopup() {
        $find('AjaxPopupHi').hide();
    }
    //Function to Show ModalPopUp
    function Showpopup() {
        $find('AjaxPopupHi').show();
    }

</script>

</head>

<form id="form1" runat="server">

<asp:LinkButton ID="lnk" OnClientClick = "Showpopup()" runat="server" Text="hi"></asp:LinkButton>


<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<br />

<asp:Button ID="Button_dummy" Style="display: none" runat="server" Text="Button" />

<ajaxToolKit:ModalPopupExtender ID="mpe" runat="server" BehaviorID="AjaxPopupHi" TargetControlID="Button_dummy" PopupControlID="pnl"
    CancelControlID="close" />

<!--BELOW panel does not remain OPEN :/-->
<asp:Panel ID="pnl" runat="server" CssClass="popupPanel">
    <div>
        Hi!!!
    </div>
    <asp:Button ID="close" runat="server" Text="Close" />
</asp:Panel>


 </form>

感谢

推荐答案

您可以使用这样

OnClientClick = "return Showpopup()"


function Showpopup() {
    $find('AjaxPopupHi').show();
    return false;
}

您必须使用回报你的OnClientClick 结合您的code

You must use return in you OnClientClick combining your code

<asp:LinkButton ID="lnk" OnClientClick = "return Showpopup()" runat="server" Text="hi">  
</asp:LinkButton>

和你的javascript函数应该像

and your javascript function should be like

function Showpopup() {
    $find('AjaxPopupHi').show();
    return false;
}

这篇关于.Show后模式弹出扩展自动关闭()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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