防止 ModalPopupExtender 在回发期间/之后关闭

2024-01-13

如何防止我的 asp:ModalPopupExtender 在回发到服务器之后或期间关闭?

这是我的代码:

脚本语言

// Confirm popup Ok button
function OnOk() {
    $('#confirmPopup').hide();
    ClickSaveButton();      // does a postback
    ShowGridPopup();
}

ASP.NET AJAX

    <asp:ModalPopupExtender BehaviorID="confirmPopup" ID="confirmPopup" runat="server"
        TargetControlID="butConfirm" PopupControlID="ConfirmView" BackgroundCssClass="modalBackground"
        OnOkScript="OnOk();" OnCancelScript="OnCancel();"
        OkControlID="yesButton" CancelControlID="noButton">
    </asp:ModalPopupExtender>

不管我打电话ShowGridPopup()在回发方法之前或之后ClickSaveButton(),弹出窗口仍然消失。我怎样才能防止这种情况发生?

EDIT

这是代码ShowGridPopup() and ClickSaveButton()

function ShowGridPopup() {
    if (getID() == "Popup1") {
        ShowGridPopup1();
    } else if (getID() == "Popup2") {
        ShowGridPopup2();
    }
}

function ClickSaveButton() {
    var _id = $('a[id$="butSave"]').attr("ID");
    __doPostBack(_id.replace("_", "$"), '');
}

你应该使用UpdatePanel,因此 ModalPopupExtender 在回发后不会被隐藏。请参阅下面的示例:

Aspx:

<body> 
    <form id="form1" runat="server"> 
    <asp:ScriptManager ID="ScriptManager1" runat="server"> 
    </asp:ScriptManager> 
    <div> 
        <asp:UpdatePanel ID="udpOutterUpdatePanel" runat="server"> 
             <ContentTemplate> 

                 <asp:Button ID="ButtonShow" runat="server" Text="Show Popup" OnClick="ButtonShow_Click" />                 


                <input id="dummy" type="button" style="display: none" runat="server" /> 
                <ajaxToolkit:ModalPopupExtender runat="server" 
                        ID="mpeThePopup" 
                        TargetControlID="dummy" 
                        PopupControlID="pnlModalPopUpPanel" 
                        BackgroundCssClass="modalBackground"                        
                        DropShadow="true"/>
                 <asp:Panel ID="pnlModalPopUpPanel" runat="server" CssClass="modalPopup"> 
                    <asp:UpdatePanel ID="udpInnerUpdatePanel" runat="Server" UpdateMode="Conditional"> 
                        <ContentTemplate> 
                            Message
                            <asp:Button ID="ButtonClose" runat="server" Text="Close Popup" OnClick="ButtonClose_Click" />                                                                  
                        </ContentTemplate>       
                    </asp:UpdatePanel> 
                 </asp:Panel> 

            </ContentTemplate> 
        </asp:UpdatePanel> 
    </div> 
    </form> 
</body>

背后代码:

    protected void ButtonShow_Click(object sender, EventArgs e)
    {
        //Show ModalPopup               

        mpeThePopup.Show(); 
    }
    protected void ButtonClose_Click(object sender, EventArgs e)
    {
        //Hide ModalPopup

        mpeThePopup.Hide();
    }
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

防止 ModalPopupExtender 在回发期间/之后关闭 的相关文章

随机推荐

  • 需要适用于 Iphone、Android、Windows/XP 的兼容 AES 代码加密/解密

    我需要能够从 Windows 向各种手机发送安全信息 我在 iPhone 和 Android 开发方面都是新手 但需要为每个环境创建一个易于使用的应用程序 与收到的短信交互也很好 我想获取适用于 iPhone Android 和 Windo
  • 如何在android活动中使用gradle.properties中的属性?

    如何在android活动中使用gradle properties中的属性 每当我构建代码时 它都会抛出错误 是否有可以在活动内部访问属性的特定方式 在 gradle properties 中 SIMPLE STRING ABC 在 buil
  • 记忆斐波那契的时间复杂度

    我最近遇到了这个 Haskell 记忆斐波那契实现 fibonacci Int gt Integer fibonacci map fib 0 where fib 0 0 fib 1 1 fib n fibonacci n 1 fibonac
  • 了解从整数到浮点数的转换

    有人能解释一下 32 位机器上这个奇怪的输出吗 include
  • 直接在视图中绑定模型属性

    我在 Prism 中找到了这段文字文档 http msdn microsoft com en us library gg405484 28v pandp 40 29 aspx 我开始使用 MVVM 但我迷失了方向 我可以 应该 在视图中绑定
  • ggplot2 中的蠕虫图残差图

    I m trying to plot the Worm plot residuals on a model fitted using the gamlss function from the gamlss package The inter
  • 使用 typedcolumn 选择 Spark 数据集

    看着select Spark DataSet 上的函数有各种生成的函数签名 c1 TypedColumn MyClass U1 c2 TypedColumn MyClass U2 这似乎暗示我应该能够直接引用 MyClass 的成员并且类型
  • TypeScript 定义函数的哈希表

    我正在尝试为车把创建一个定义文件 以便与预编译的车把脚本一起使用 Handlebars 会将预编译的脚本放入字符串索引的函数哈希表中 但我无法弄清楚或找到如何定义它 假设的定义是 declare module Handlebars expo
  • 使用连接字段的结果更新文档

    考虑包含以下文档的集合 id aaaaaaaaaaaa title Hello World date Thursday November 12 2015 time 9 30 AM endtime 11 30 AM id bbbbbbbbbb
  • Http-Conduit 频繁连接失败

    我正在编写将通过 HTTP 下载一些文件的应用程序 在某种程度上 我使用以下代码片段来下载页面正文 import network HTTP simpleHTTP getRequest http www haskell org gt gt g
  • 在 VueJS 中使用按钮进行水平滚动

    我希望使用 VueJS 中的按钮实现水平滚动 我有一个容器 其中有几个水平堆叠的 div 我想使用按钮滚动它们 Here https stackoverflow com questions 25028040 jquery horizonta
  • Google reCAPTCHA 的remoteip 参数被忽略

    在 recaptcha 的文档中 https developers google com recaptcha docs verify https developers google com recaptcha docs verify 它说r
  • 在 WPF 窗口中完全删除标题栏的上下文菜单

    I have created a WPF Window and set its Window Style property to None Yet when I press Alt Up Key combination a context
  • nginx 反向代理 - 如何为多个应用程序提供服务

    我正在尝试使用 nginx 构建一个反向代理 以使我的项目中的所有内容都可以从单个地址访问 对于单个服务 以下配置可以正常工作 etc nginx sites enabled reverse proxy conf server listen
  • 将图像存储在 Core Data 中还是作为文件?

    我有一组数据也包含图像 我想缓存这些数据 我应该将它们存储在文件系统还是核心数据上 为什么 有两个主要选项 将文件存储在磁盘上 然后将图像的路径存储在core data中 将图像的二进制数据存储在core data中 我个人更喜欢第一个选项
  • Worklight 6.0.0.1 和 iOS 7 - 屏幕底部出现白条?

    我一直在使用 Worklight 6 0 0 1 我注意到在 iOS 7 上运行的所有 Worklight 应用程序中 屏幕底部有一个白色条的问题 我知道 Worklight 和 iOS 7 的用户之前已经提到过这个问题 IBM Workl
  • Nightwatch 中的 setValue 方法不起作用

    我正在尝试设置一个新的 Nightwatch 项目 以便自动化简单的 Google 搜索页面 我的断言页面上存在的搜索框通过 但我无法对元素执行任何鼠标 键盘操作 Searchbox or SearchButton Note 我正在运行夜巡
  • 将 S3 对象访问限制为来自特定域的请求

    我在 S3 中有视频文件 还有一个通过 src 属性加载文件的简单播放器 我希望只能通过我的网站查看视频 而不是直接通过 S3 URL 这可能在页面的源代码中可见或通过右键单击访问 浏览 AWS 文档 我似乎可以通过 HTTP 执行此操作的
  • Polymer core-ajax跨域问题

    我正在尝试使用 Polymer 进行跨域调用核心ajax http www polymer project org docs elements core elements html core ajax成分 我不断收到请求的资源上没有 Acc
  • 防止 ModalPopupExtender 在回发期间/之后关闭

    如何防止我的 asp ModalPopupExtender 在回发到服务器之后或期间关闭 这是我的代码 脚本语言 Confirm popup Ok button function OnOk confirmPopup hide ClickSa