我的页面上有back
button
。点击back
button
后面的代码执行。
PageInformation InfoView = new PageInformation ();
InfoView = (PageInformation )ViewState["PBLSave"];
if (txtValidFPGTE18MQ1.Text != InfoView.FPGTE18.Q1.ToString() || txtValidFPGTE18MQ2.Text != InfoView.FPGTE18.Q2.ToString()
|| txtValidFPGTE18MQ3.Text != InfoView.FPGTE18.Q3.ToString() || txtValidFPGTE18MQ4.Text != InfoView.FPGTE18.Q4.ToString()
|| txtValidFPGTE18MQ5.Text != InfoView.FPGTE18.Q5.ToString() || txtValidFPGTE18MQ6.Text != InfoView.FPGTE18.Q6.ToString())
{
mdlPopupExtender.Show();
}
else
{
redirectUrl = "../UI/Summary_Page.aspx";
Response.Redirect(redirectUrl);
}
这里mdlPopupExtender
是我定制的模态窗口。我想执行整个代码,并在浏览器click
的{{1}}和浏览器后退按钮上显示此模态窗口。我该怎么做呢?
答案 0 :(得分:0)
假设函数名称为RunOnClose
在CS文件中
<script type="text/javascript">
window.onbeforeunload = function () {
$.ajax({
type: "POST",
url: "WebForm1.aspx/RunOnClose",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function () {
alert('Funtion called!');
},
error: function () {
alert('Funtion not called');
}
});
};
</script>
在aspx文件中
GPS location in Android app