取消按钮在Modelpopup扩展器中不起作用 [英] Cancel button not working in modelpopup extender
本文介绍了取消按钮在Modelpopup扩展器中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个modalpopup扩展程序,其代码可用于除CANCEL按钮之外的所有功能,有人可以帮我解决这个问题吗
I have a modalpopup extender coded which works for everything except CANCEL button, can someone help me out with this
<script language="javascript" type="text/javascript">
function ShowMyModalPopup(id)
{
var modal = $find('ModalPopupExtender1');
modal.show();
}
function BindGrid(id) {
document.getElementById("hidPId").value = id;
}
function HideModalPopup() {
var modal = $find('ModalPopupExtender1');
modal.hide();
}
</script>
<div id="panelOntap" runat="server" class="ModalWindow">
<asp:UpdatePanel ID="UpdatePanel22" runat="server" >
<ContentTemplate>
<div style="text-align:center">
<asp:Label ID="Lbl1" runat="server" Text="COMPATIBLE SHELFS/DRIVES ">
</asp:Label>
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="true">
<RowStyle CssClass="RowStyle" />
<EmptyDataRowStyle CssClass="EmptyRowStyle" />
<PagerStyle CssClass="PagerStyle" />
<SelectedRowStyle CssClass="SelectedRowStyle" />
<HeaderStyle CssClass="HeaderStyle" />
</asp:GridView>
<asp:Button ID="btncancel" runat="server" Text="close" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="panelOntap"
TargetControlID="panelOntap" BackgroundCssClass="modalBackground" CancelControlID="btncancel" OnCancelScript="HideModalPopup()">
</asp:ModalPopupExtender>
<asp:Button ID="ButtonEdit" runat="server" Text="Edit Expanse" style="display:none" />
<asp:HiddenField ID="hidPId" runat="server" />
</div>
推荐答案
find('ModalPopupExtender1'); modal.show(); } 函数BindGrid(id){ document.getElementById("hidPId").value = id; } 函数HideModalPopup(){ var modal =
find('ModalPopupExtender1'); modal.show(); } function BindGrid(id) { document.getElementById("hidPId").value = id; } function HideModalPopup() { var modal =
find('ModalPopupExtender1'); modal.hide(); } < /script >
find('ModalPopupExtender1'); modal.hide(); } </script>
<div id="panelOntap" runat="server" class="ModalWindow">
<asp:UpdatePanel ID="UpdatePanel22" runat="server" >
<ContentTemplate>
<div style="text-align:center">
<asp:Label ID="Lbl1" runat="server" Text="COMPATIBLE SHELFS/DRIVES ">
</asp:Label>
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="true">
<RowStyle CssClass="RowStyle" />
<EmptyDataRowStyle CssClass="EmptyRowStyle" />
<PagerStyle CssClass="PagerStyle" />
<SelectedRowStyle CssClass="SelectedRowStyle" />
<HeaderStyle CssClass="HeaderStyle" />
</asp:GridView>
<asp:Button ID="btncancel" runat="server" Text="close" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="panelOntap"
TargetControlID="panelOntap" BackgroundCssClass="modalBackground" CancelControlID="btncancel" OnCancelScript="HideModalPopup()">
</asp:ModalPopupExtender>
<asp:Button ID="ButtonEdit" runat="server" Text="Edit Expanse" style="display:none" />
<asp:HiddenField ID="hidPId" runat="server" />
</div>
尝试删除
OnCancelScript="HideModalPopup()
,它将按您将其设置为cancel controlid的方式工作.
, it will work as you have set it as cancel controlid.
这篇关于取消按钮在Modelpopup扩展器中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文