First of all let me inform you, I am new to Threading concept.
Please note that I'm using Visual Studio 2010 (Framework : 4.0).
What I have to achieve is, create web page having three buttons and one label. and two grid to load data.
Buttons..
1.
Start Thread - On Click of this button thread should start.
2.
Load data in Grid 1 (Whatever operation you want but it must be server side)
3.
Load data in Grid 2
Label that will display status of thread i.e. Thread started, when thread is over thread completed.
When Thread operation is going on, and If User click "Load data in Grid 1", it should load data..
If user click "Load data in grid 2", data should be loaded.
:confused:Problem what I am facing is that, until thread operation is in process.
I cant Load data in Grid.
Following code i have used for Start thread
protected void btnStartThread_Click(object sender, EventArgs e)
{
BackgroundWorker workerLocal = new System.ComponentModel.BackgroundWorker();
workerLocal.DoWork += new DoWorkEventHandler(DoWork);
workerLocal.WorkerReportsProgress = false;
workerLocal.WorkerSupportsCancellation = true;
workerLocal.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(WorkerCompleted);
workerLocal.RunWorkerAsync();
}
private static void DoWork(object sender, DoWorkEventArgs e)
{
try
{
for (index = 0; index < 50000; index++)
{
}
}
catch (Exception)
{
throw;
}
}
private static void WorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
}
Thanks in Advance..