How to update UI controls(ex. list box) from another thread in ASP.NET? From the below code I am expecting to update listbox once performLongTask1() and performLongTask2() completes execution and also should update in the order of finishing task.
- protected void Button1_Click(object sender, EventArgs e)
- {
- Thread t1 = new Thread(performLongTask1);
- Thread t2 = new Thread(performLongTask2);
- t1.Start();
- t2.Start();
- ListBox1.Items.Add("LongTask1 Started");
- ListBox1.Items.Add("LongTask2 Started");
- }
- private void performLongTask1()
- {
- Thread.Sleep(5000);
-
- }
- private void performLongTask2()
- {
- Thread.Sleep(10000);
-
- }