现在的位置: 首页 > 移动开发 > 正文

如何在asp.net事件中启动线程来打开一个页面

2020年06月01日 移动开发 ⁄ 共 1047字 ⁄ 字号 评论关闭

  在页面点击一个按钮,其目的是在按钮中做两件事情,一件需要点击按钮马上完成,另一件事情是点击按钮后做其他事情。下面学步园小编来讲解下如何在asp.net事件中启动线程来打开一个页面?

  如何在asp.net事件中启动线程来打开一个页面

  [csharp]viewplaincopyprint?

  protectedvoidButton1_Click(objectsender,EventArgse)

  {

  Label1.Text=TextBox1.Text;

  //在这做第一件事情protectedvoidButton1_Click(objectsender,EventArgse)

  {

  Label1.Text=TextBox1.Text;

  //在这做第一件事情[csharp]viewplaincopyprint?

  dowork();

  dowork();[csharp]viewplaincopyprint?

  //做完后马上启动线程

  System.Threading.Threadthread=newSystem.Threading.Thread(newSystem.Threading.ThreadStart(ThreadChild));

  thread.Start();

  }

  如何在asp.net事件中启动线程来打开一个页面

  //做完后马上启动线程

  System.Threading.Threadthread=newSystem.Threading.Thread(newSystem.Threading.ThreadStart(ThreadChild));

  thread.Start();

  }

  线程中处理完后打开一个窗口

  publicvoidThreadChild()

  {

  Label2.Text=DateTime.Now.ToString();

  //Response.Write("");

  //响应http必然报错

  //Response.Write("");

  //通过注册即可打开窗口

  Page.RegisterStartupScript("","");

  }

  以上就是关于“如何在asp.net事件中启动线程来打开一个页面”的内容,希望对大家有用。更多资讯请关注学步园。学步园,您学习IT技术的优质平台!

抱歉!评论已关闭.