onokay脚本在我的代码中不起作用。我的目的是在点击okay按钮时调用asp按钮点击事件,如果是取消按钮,则无需调用按钮点击事件。在下面我给出了我写的代码。任何人都可以帮我解决这个问题。
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:Button ID="submit" runat="server" Text="Submit" onclick="submit_Click" ValidationGroup="submt"/>
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" cancelcontrolid="btnCancel" okcontrolid="btnOkay" targetcontrolid="submit" popupcontrolid="Panel1" popupdraghandlecontrolid="PopupHeader" drag="true" backgroundcssclass="ModalPopupBG" OnOkScript="onok();"></asp:ModalPopupExtender>
<asp:panel id="Panel1" style="display: none" runat="server">
<span id="overlay"></span>
<div class="HellowWorldPopup">
<div class="PopupHeader" id="PopupHeader">Warning</div>
<div class="PopupBody">
<p>Do you want to change the password!!!</p>
</div>
<div class="Controls">
<input id="btnOkay" type="button" value="Okay"/>
<input id="btnCancel" type="button" value="Cancel" />
</div>
</div>
</asp:panel>
<script type="text/javascript">
function onok() {
return true;
}
</script>
答案 0 :(得分:0)
更改toolkitscriptmanager而不是脚本管理器。最好的理由see here
答案 1 :(得分:0)
将以下代码javascript添加到呼叫服务器按钮单击事件:
function onOk(){ __doPostBack(“&lt;%= submits.UniqueID%&gt;”,“OnClick”);
}