Grid View for ASP.NET Web Forms - How to show a lengthy operation's progress and allow canceling such operations
This example is created based on recommendations from the How to display progress information about server-side callback processing example.
The main idea is to divide long-time operations into different steps. Thus, if you know which step is performed, you can display the progress information:
int countOfOperations = 100;
for(int i = 0; i < countOfOperations; i++) {
progressInPercent = Math.Round((double)i / countOfOperations * 100);
System.Threading.Thread.Sleep(150);
//Do some steps here
}
Or cancel the processing after finishing of one of these steps:
protected void clbCancel_Callback(object source, DevExpress.Web.CallbackEventArgs e) {
isCancelRequired = true;
}
// ...
isCancelRequired = false;
int countOfOperations = 100;
for(int i = 0; i < countOfOperations; i++) {
// ...
if(isCancelRequired)
return;
}
- How to cancel ASPxGridView Callback
- How to display progress information about server-side callback processing (MVC)
- How to use HTTP handlers to display the progress of a server-side process on the client
- How to track progress of server side processing on the client side (using HttpModule)
- How to use the WebMethod attribute to display the progress of a server-side process on the client