Hi guys,

I have a long running process called as the balancing process. This process updates the records in the database.
I have 2 radio buttons
1: Show all records

2: Show only imbalances

These radio buttons are used to fetch the data fromt he database and display them on my web page. The 2nd radio button shows only the imbalance records as the name suggests and the 1st one shows all the records. In order to balance the Imbalances I have the balancing function. This function is implemented using the Balance button.
Now, My problem is that when i press the balance button, the process freezes up the page and when i press either of the radio buttons the toggling takes place but no event is fired i.e the page does not refresh and the data which is there on the screen is seen as it is until the balancing process ends.

I want that while the balancing process is running, I should be able to see how the records increase/decrease from the ‘Show All’/ ‘Show Only Imbalances’ screens. Right now, I can see the initial state of these screens ,and ONLY after the process is completed, then I can see how the number of records changed. The screens are not refreshing with what’s happening while the process is running. I have used a grid view to display the data.

please help guys!!!!!

System.Threading.Tasks.TaskFactory.StartNew(() => MyLongRunningMethod());

Thanx for your Reply...but i think this is possible in .NET 4.0. I am working in .NET 3.0...you have any sol'n for 3.0....

hey thanks!!
Background worker is a great help...But i am facing a problem. When I press the Balancing button the async process starts.However when I press any of the the Radio buttons after starting the balancing function, i get the data in my grid however the balance process doesn't work anymore. It's getting aborted somehow. I don't get the final result which i expect to be displayed on a label. I have handled the RunWorkerCompleted event and want to display the result at the end of the balancing operation there. If i don't press the radio button in between the balancing process then i get the result.

Please help!!

I suspect that you are getting a cross-thread error that is causing the routine to fail. Are trying to acces the datagridview in the background worker? If so, that is likely the cause.

Guys i am working with ASP.Net. Is the backgroundworker not applicable here?
i guess the pageload is troubling me. Since, every time i press the radio button while the balance function is running there is pageload and the balancing process is aborted....

Can anyone please tell me how to use the Backgroundworker in ASP.net. i have searched evrything, however i couldn't find any example showing the use of backgroundworker class in ASP.net. There are examples about the windows application forms.

Please Help!!

Guys i have used the delegates in my application to establish the asynchronous process.
But i have a layered architechture in which there are 3 layers. Now my Balancing process has many function calls in it. Should i call all these functions asynchronously from my main process?
Cause if i don't do it they are getting called synchrnously.
Please Help.