当前位置: 移动技术网 > IT编程>开发语言>.net > asp.net如何在事件中启动线程来打开一个页面

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

2018年10月30日  | 移动技术网IT编程  | 我要评论

wow初级燃料学,杉原杏璃のlife,狂君

在页面点击一个按钮,其目的是在按钮中做两件事情,一件需要点击按钮马上完成,另一件事情是点击按钮后做其他事情。如果按顺序一次做完感觉特别耗时,下面简单罗列一下。[csharp] view plaincopyprint?
protected void button1_click(object sender, eventargs e) 
    { 
        label1.text = textbox1.text; 
 
      //在这做第一件事情 

protected void button1_click(object sender, eventargs e)
    {
        label1.text = textbox1.text;

   //在这做第一件事情[csharp] view plaincopyprint?
dowork(); 

   dowork();[csharp] view plaincopyprint?
//做完后马上启动线程  
     system.threading.thread thread = new system.threading.thread(new system.threading.threadstart(threadchild)); 
     thread.start(); 
 } 

   //做完后马上启动线程
        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("<script>window.open('login.x','','');</script>");

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

          page.registerstartupscript("", "<script>window.open('login.aspx','','');</script>");

 }

 

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网