您现在的位置是:网站首页> 编程资料编程资料
asp.net在事件中启动线程来打开一个页面的实现方法_实用技巧_
2023-05-24
325人已围观
简介 asp.net在事件中启动线程来打开一个页面的实现方法_实用技巧_
在页面点击一个按钮,其目的是在按钮中做两件事情,一件需要点击按钮马上完成,另一件事情是点击按钮后做其他事情。如果按顺序一次做完感觉特别耗时,下面简单罗列一下。
protected void Button1_Click(object sender, EventArgs e) { Label1.Text = TextBox1.Text; //在这做第一件事情 dowork(); //做完后马上启动线程 System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ThreadStart(ThreadChild)); thread.Start(); } 线程中处理完后打开一个窗口
public void ThreadChild() { Label2.Text = DateTime.Now.ToString(); //Response.Write(""); //响应http必然报错 //Response.Write(""); //通过注册即可打开窗口 Page.RegisterStartupScript("", ""); } 您可能感兴趣的文章:
相关内容
- asp.net页面触发事件panel滚动条高度不变的实现方法_实用技巧_
- asp.net C#实现解压缩文件的方法_实用技巧_
- ASP.NET Repeater 单双行数据换色示例_实用技巧_
- asp.net中的check与uncheck关键字用法解析_实用技巧_
- .net采用ajax实现邮箱注册和地区选择实例_实用技巧_
- 进度条在.net导入Excel时的应用实例_实用技巧_
- .net开发微信公众平台实例教程_实用技巧_
- asp.net中EXCEL数据导入到数据库的方法_实用技巧_
- ASP.NET oledb连接Access数据库的方法_实用技巧_
- ASP.NET连接sql2008数据库的实现代码_实用技巧_
