TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Pradeep S
1.3k
471
622.6k
How to update UI controls from another thread in ASP.NET?
Sep 29 2019 10:43 PM
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);
//ListBox1.Items.Add("LongTask1 Completed");
}
private
void
performLongTask2()
{
Thread.Sleep(10000);
//ListBox1.Items.Add("LongTask2 Completed");
}
Reply
Answers (
3
)
D.B disconnect after run application
How to read value from database and write into text file