我正在尝试在 jQuery 对话框中加载“取消”页面。
jQuery 对话框有确认按钮“YES”和“NO”。如果我单击“是”按钮,它应该从jQuery 对话框中加载的页面触发按钮click
事件。cancel.aspx
如何从加载的页面调用点击事件?
修改.aspx
<html>
<div id="dialogCancel" style="display: none;"></div>
<script type="text/javascript">
$("#dialogCancel").load('Cancel.aspx').dialog({
open: function() {
$(".ui-dialog-titlebar-close").hide();
},
width: '300',
height: '200',
modal: true,
draggable: false,
resizable: false,
show: {
effect: 'fade',
duration: 1500
},
buttons: {
'Yes': function() {
//if YES fire button click event from cancel page loaded in jquery dialog.
location.reload(true);
},
'No': function() {
$(this).dialog('close');
}
}
});
</script>
</html>
取消.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Cancel.aspx.cs" %>
<html>
<head id="Head1" runat="server">
<title></title>
<link href="Scripts/Jquery/themes/dark-hive/jquery-ui.css" rel="stylesheet" type="text/css" />
</head>
<body bgcolor="red">
<form id="Cancel" runat="server">
<div id="div1">
<center>
<br />
<br />
<asp:Button ID="btnCancel" runat="server" Text="Yes" Height="28px" Visible="False" onclick="btnCancel_Click" />
</center>
</div>
</form>
</body>
</html>