Posted on: 2/4/2014 10:31:07 PM | Views : 606

Hello, I have a web app and on page load I bind 5 gridviews. For performance issues I start 5 different threads for retreiving the DataSource and bind all the grinds when all threads are complete. I build the Datasource from google anayltics so retreive the data can take a bit of time so it looks like this: 
protected void Page_Load(object sender, EventArgs e) { System.Threading.Thread thread1 = new System.Threading.Thread(BuildDataTable1); Threads.Add(thread1); thread1.Start(); System.Threading.Thread thread2 = new System.Threading.Thread(BuildDataTable2); Threads.Add(thread2); thread2.Start(); System.Threading.Thread thread3 = new System.Threading.Thread(BuildDataTable3); Threads.Add(thread2); thread3.Start(); // 4 and 5... bool AllThreadsFinished = false; while (!AllThreadsFinished) { AllThreadsFinished = true; foreach (Thread MyThread in Threads) { if (MyThread.IsAlive) AllThreadsFinished = false; ...

Go to the complete details ...