如何在页面加载事件中停止事件执行 [英] How can I stop event excution in the page load event
问题描述
我已经申请了超过2年的申请,我们有近60种表格。如果会话过期,最初客户端请求重定向到登录页面。但是现在他们希望我们在用户按下控件(如按钮)时显示弹出窗口。我正在做的是检查页面加载会话并使用javascript显示弹出窗口。我只是想停止页面加载本身的执行周期。请看下面的代码。
HTML
< asp:按钮 ID = button runat = server onclick = button_Click 文本 = 检查 / >
C#代码:
protected void Page_Load( object sender,EventArgs e)
{
if (会话[ 用户]!= null )
{
// 页面加载功能
}
else
{
// 这里我将调用我创建的Jquey Popup
// 我不想通过调用button_Click
}
} $ b继续此执行过程
$ b 受保护 vo id button_Click( object sender,EventArgs e)
{
// 保存合同
}
有什么办法在那个条件下停止执行周期。请给我这个场景的建议或者请让我知道这样做。
重定向到待机页面。此页面必须保存原始网址,并且应该是弹出式登录表单的所有者。
验证用户后,再次重定向到原始网址。
Hi,
I have been working with an application for more that 2 years, we have nearly 60 forms. Initially client requested to redirect to log in page if the session expires. But now they want us to show a log in popup when the user press a control (like button). What I am doing is checking the session on the page load and display a popup using javascript. I just want to stop the execution cycle in the page load itself. please see the below code.
HTML
<asp:Button ID="button" runat="server" onclick="button_Click" Text="Check" />
C# Code:
protected void Page_Load(object sender, EventArgs e)
{
if (Session["User"] != null)
{
//Page load function
}
else
{
//Here i will call the Jquey Popup that I have created
//I dont want to continue this execution process by calling button_Click
}
}
protected void button_Click(object sender, EventArgs e)
{
//Save contition
}
is there any way to stop the execution cycle in that else condition. Please give me suggestion for this scenario or please let me know idea to do this.
Redirects to a stand-by page. This page must save the original url and it should be the owner of pop-up login form.
After validating the user, redirects to the original url again.
这篇关于如何在页面加载事件中停止事件执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!