Thu 28 Jan 2010

Few days before, I was having problem that after clicking on Export to pdf button / image, other controls of web part/user control stops working on the application page on WSS 3.0 environemnt that has RadGrid on it.

While the same thing was working on other asp.net application outside the sharepoint environment.

1st workaround (can be a solution)

The cause for this behavior is that there is a flag (named _spFormOnSubmitCalled) in SharePoint which prevents double form submition. This flag is set when the form is submitted and clear when the response is received.
However when exporting the response is redirected and the page is not updated, thus the flag is not cleared and page's postbacks are blocked.

In order to workaround this behavior you should manually clear the flag when exporting. This can be achieve, for example in export button's client click function similar to the following:

MyExportButton.OnClientClick = "_spFormOnSubmitCalled = false;"  

Above workaround will allow you to export multiple times, but all the other controls on the page were still not functional after the export.

2nd workaround (Not / Never recommended)

In your sharepoint master page, remove onsubmit attribute from your form tag

<form runat="server" onsubmit="return _spFormOnSubmitWrapper();"> 

and remove the onsubmit attribute.  This is what it looks like now:

<form runat="server"> 

3rd workaround (so far so good and implementable)

Add the following script to your webpart / custom control that need to have export and other controls functionals, rather then implementing the above workarounds
So here you go with the working solution.

<script type="text/javascript" language="javascript">

    //sharepoint postback to work after clicking on telerik export to pdf
    if (typeof (_spBodyOnLoadFunctionNames) != 'undefined' && _spBodyOnLoadFunctionNames != null) {
        _spBodyOnLoadFunctionNames.push("supressSubmitWraper");
    }

    function supressSubmitWraper() {
        _spSuppressFormOnSubmitWrapper = true;
    }
   
</script>

 

Hope this will helps.

 

E-mail this post to someone or Comments (16)

Comments

3/10/2010 | ken  United States
Awesome job. It worked for me.
1/11/2011 | ankit khandekar  United States
Thanks for you blog. It really helped me a lot.

Thanks
Ankit
3/8/2011 | Kelly  United States
Thanks so much - it took me a while to find this post but it has saved me a lot of touble!
9/28/2011 | Phil  United Kingdom
Thanks for the post. It really helped me out.
1/20/2012 | Di  Australia
Brilliant - worked like a dream!  
Thanks so much for sharing your simple solution - had been searching round and was only finding convoluted things that made me think 'there must be an easier way!' -and you did it.
Well done.
3/13/2012 | Y. Miyazawa  Italy
Thank you so much! Exactly what I needed!
8/6/2012 | Rickey  United States
Hours of fighting with Telerik and SharePoint solved with a simple copy and paste. Thanks.
11/2/2012 | Des  United Kingdom
Nice one. Problem solved.
2/27/2013 | Shelley  United States
It (3rd workaround) works like a charm! Really appreciated it!
10/18/2013 | Adrian Calvo  Costa Rica
Thank you !
12/19/2013 | Ash  Australia
Thank u . Really appreciated it!!!
8/26/2015 | Raj  Australia
I faced this issue using Q1 2015 version of the Telerik control suite and your 3rd option worked like a charm! Thanks heaps!
12/3/2015 | Hem Chandra  United States
Thank you so much! Exactly what I needed!
5/29/2016 | M.A Bakar  U.A.E.
Brilliant !  Thanks a  lot..
6/28/2016 | Pradeep  India
It worked like a charm! Thank you so much!!!
8/24/2016 | BIlawal Asghar  Islamic Republic of Pakistan
awesome job great!

Add Comment Post comment

 
 
 
   Country flag

Loading

For mobile, tablets or touch devices, if verify button is disabed, please press Enter after entering captcha verfication text than click Verify button.