Export to Excel in SharePoint Application Page doesn’t work on second time

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;”

Setting the _spFormOnSubmitCalled to false is actually what MS Ajax is doing when an ajax request is made thus I suspect there should be not implication using such approach.

About the removing spFormOnSubmitWrapper function call, you may instead set _spSuppressFormOnSubmitWrapper variable to true, which can be done conditionally only where needed by outputting similar to the following script:

_spBodyOnLoadFunctionNames.push(“supressSubmitWraper”);
function supressSubmitWraper()
{
_spSuppressFormOnSubmitWrapper = true;
}

来源: http://www.telerik.com/community/forums/aspnet-ajax/grid/export-to-excel-in-sharepoint-application-page.aspx

发表评论

电子邮件地址不会被公开。

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>