gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 16:29:22 24 4
gpt4 key购买 nike

我正在尝试从 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>

有什么想法吗?

谢谢

杰森

最佳答案

尝试定义 ModalPopupExtender 的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.

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

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

关于javascript - 为什么我的 ModalPopupExtender 不显示? ASP.NET 和 JavaScript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6670945/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com