为什么我的 ModalPopupExtender 不显示? ASP.NET 和javascript

发布于 2024-11-23 19:24:25 字数 1349 浏览 1 评论 0原文

我正在尝试从 javascript 调用模式弹出扩展程序。这是调用:

function MyFunction()
   {alert("test");
   $find('mdlPassword').show;}

调用时我收到警报,但模式弹出扩展程序不会显示。这是 aspx 的东西:

<!-- Popup Extenders Should Go Here -->
<asp:button id="Button1" runat="server" text="Button" style="display: none;" />
<asp:ModalPopupExtender ID="mdlPassword" runat="server"
    targetcontrolid="Button1" popupcontrolid="pnlPassword" 
    popupdraghandlecontrolid="PopupHeader" drag="true">
</asp:ModalPopupExtender>

<asp:Panel ID="pnlPassword" style="display: none" runat="server">
<div class="PasswordPopup">
            <div id="PopupHeader">&nbsp;</div>
            <div class="Controls">
                <center><table><tr>
                    <td>Please enter your password:</td><td><input type="password" name="Password" /></td></tr>
                <tr><td>&nbsp;</td>
                    <td><asp:linkbutton id="btnOK" runat="server" text="OK" />&nbsp;&nbsp;<asp:linkbutton id="btnCancel" runat="server" text="Cancel" /></td></tr></table></center>
            </div>
 </div>
</asp:Panel>

有什么想法吗?

谢谢,

杰森

I'm trying to call a modal popup extender from javascript. Here's the call:

function MyFunction()
   {alert("test");
   $find('mdlPassword').show;}

I get the alert when it's called, but the modal popup extender won't show. Here's the aspx stuff:

<!-- Popup Extenders Should Go Here -->
<asp:button id="Button1" runat="server" text="Button" style="display: none;" />
<asp:ModalPopupExtender ID="mdlPassword" runat="server"
    targetcontrolid="Button1" popupcontrolid="pnlPassword" 
    popupdraghandlecontrolid="PopupHeader" drag="true">
</asp:ModalPopupExtender>

<asp:Panel ID="pnlPassword" style="display: none" runat="server">
<div class="PasswordPopup">
            <div id="PopupHeader"> </div>
            <div class="Controls">
                <center><table><tr>
                    <td>Please enter your password:</td><td><input type="password" name="Password" /></td></tr>
                <tr><td> </td>
                    <td><asp:linkbutton id="btnOK" runat="server" text="OK" />  <asp:linkbutton id="btnCancel" runat="server" text="Cancel" /></td></tr></table></center>
            </div>
 </div>
</asp:Panel>

Any ideas?

Thanks,

Jason

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心意如水 2024-11-30 19:24:25

尝试定义 ModalPopupExtender 的BehaviorID:

<asp:ModalPopupExtender ID="mdlPassword" runat="server"
    BehaviorID="mdlPassword"
    targetcontrolid="Button1" popupcontrolid="pnlPassword" 
    popupdraghandlecontrolid="PopupHeader" drag="true">
</asp:ModalPopupExtender>

BehaviorID:如果您想访问客户端
您可以通过客户端中的脚本代码设置扩展程序的行为
这个BehaviorID可以简化流程。

显示和隐藏弹出窗口的脚本:

<script language="javascript">
   function showPopup()
   {
       $find('mdlPassword').show();
   }
   function hidePopup()
   {
       $find('mdlPassword').hide();
   }
</script>

Try to define the ModalPopupExtender's BehaviorID:

<asp:ModalPopupExtender ID="mdlPassword" runat="server"
    BehaviorID="mdlPassword"
    targetcontrolid="Button1" popupcontrolid="pnlPassword" 
    popupdraghandlecontrolid="PopupHeader" drag="true">
</asp:ModalPopupExtender>

BehaviorID: In cases where you would like to access the client-side
behavior for your extender from script code in the client, you can set
this BehaviorID to simplify the process.

The script for showing and hiding the popup:

<script language="javascript">
   function showPopup()
   {
       $find('mdlPassword').show();
   }
   function hidePopup()
   {
       $find('mdlPassword').hide();
   }
</script>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文