Ultimate Collection - { fslBlog & faisalmb.com } Ultimate Collection - { fslBlog & faisalmb.com }   
Blog   |   Site   |   Posts (326)   |   Tags Xplorer   |   Feed Subscribe Free! Aha! you surfing post Controls not functional a... Sign in    Partner Site - Real Home Contact Search   

Thu

28

Jan

2010

   

Controls not functional after Export to Excel or Export to PDF of Telerik in Sharepoint Application page



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.

 

Tags: , ,

Categories : Computers / Programming / Mobiles


Comments

Add Comment Add comment

 
 
 
   Country flag

biuquote
  • Comment
  • Preview
Loading





Intro

Faisal Bashir
Software Architect
KalSoft Limited
Microsoft Certified Technology Specialist.
Currently in Dubai. [more]

Recent Comments

Comment RSS

Calendar

<<  March 2010  >>
MoTuWeThFrSaSu
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234

View posts in large calendar

A Muslim is he from whose tongue and hands, other Muslims are safe. (Muhammad - peace be upon him - sallallaho alaihi wassallam) (ref. Al-Bukharee, Vol 1 No 9, Muslim Vol 1 No 64 & Abu Dawud No 2475)
210364 hits. (Best viewed @ 1024x768 resolution min.) Comments here...
© 2001-2009 Muhammad Faisal | Disclaimer | Contact | Partner Site