Click a button on the page to do two things in the button, one is to click the button to finish immediately, and the other is to do other things after clicking the button. If it takes a lot of time to finish the task in sequence, let's take a look at it. [Csharp] view plaincopyprint?
Protected void button#click (object sender, EventArgs e)
{
Label1.Text = TextBox1.Text;
// Do the first thing here
Protected void button#click (object sender, EventArgs e)
{
Label1.Text = TextBox1.Text;
// Do the first thing here [csharp] view plaincopyprint?
Dowork ();
Dowork (); [csharp] view plaincopyprint?
// Start the thread immediately after completion
System. Threading. Thread thread = new System. Threading. Thread (new System. Threading. ThreadStart (ThreadChild ));
Thread. Start ();
}
// Start the thread immediately after completion
System. Threading. Thread thread = new System. Threading. Thread (new System. Threading. ThreadStart (ThreadChild ));
Thread. Start ();
}
Open a window after processing in the thread
Public void ThreadChild ()
{
Label2.Text = DateTime. Now. ToString ();
// Response. Write ("");
// An error is inevitable in response to http requests.
// Response. Write ("<script> window. open ('login. aspx ','', ''); </script> ");
// You can open the window by registering
Page. RegisterStartupScript ("", "<script> window. open ('login. aspx ','', ''); </script> ");
}