Ever got a request of showing the SharePoint 2010 native processing image for the long running operation in a modal dialog?
Yes I am talking about this kind of page.
The solution is simple, use a in-build class for SharePoint called the SPLongOperation. I am sure most of the people have used this in SharePoint 2007. With SharePoint 2010, as you see i am trying to run this in SharePoint 2010 modal popup page.
This is how you get this page
The question with SharePoint 2010 modal dialog is how do you get this page to close after finishing the operation. In 2007 all we need to do was to call the end method on the longoperation object and pass the page where we need to redirect after the completion, as a parameter to the end method. This will redirect the modal page to the parameter and that will be off no help.
In 2010, the final step in the case when you are running this long operation in the modal dialog box will be to give a to the longoperation.endscript method and pass the script to close the modal popup. This is how the final code will look like.