我正在尝试从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"> </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>
有什么想法吗?
谢谢,
杰森
答案 0 :(得分:4)
尝试定义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>