Sunday, 10 November 2013

Button not working after first time - Telerik SharePoint

Recently I faced an issue while developing "Export to Excel" functionality for Telerik grid in Webpart for SharePoint 2010. Export to excel was not working once the user has clicked the button. After some googling, I found that by using following JavaScript snippet in the Webpart or Page, this issue can be resolved and it worked for me :

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

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

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

Hope it can help someone!!

2 comments: