asp.net在事件中启动线程来打开一个页面的实现方法
在页面点击一个按钮,其目的是在按钮中做两件事情,一件需要点击按钮马上完成,另一件事情是点击按钮后做其他事情。如果按顺序一次做完感觉特别耗时,下面简单罗列一下。
protectedvoidButton1_Click(objectsender,EventArgse)
{
Label1.Text=TextBox1.Text;
//在这做第一件事情
dowork();
//做完后马上启动线程
System.Threading.Threadthread=newSystem.Threading.Thread(newSystem.Threading.ThreadStart(ThreadChild));
thread.Start();
}
线程中处理完后打开一个窗口
publicvoidThreadChild()
{
Label2.Text=DateTime.Now.ToString();
//Response.Write("");
//响应http必然报错
//Response.Write("<script>window.open('login.aspx','','');</script>");
//通过注册即可打开窗口
Page.RegisterStartupScript("","<script>window.open('login.aspx','','');</script>");
}
热门推荐
1 训练狗狗憋尿
2 狗狗追踪训练
3 狗狗训练要多少钱
5 深圳狗狗训练
6 训练狗狗唤回
7 狗狗叫怎么训练
8 狗狗训练班
10 狗狗社会化训练
11 狗狗叫回训练
12 广州狗狗训练学校
13 狗狗训练躺下
14 狗狗随行训练
15 训练狗狗巡回
16 狗狗要怎么训练
17 狗狗喂食训练
18 训练狗狗躺下