I created a custom web part for SharePoint 2010 with grid view(.Net) control getting date from data table.I implemented a button "Export to Excel" to export data table value in excel to be saved locally from the grid view.
I implemented the requirement completely and tested it and as expected it is working perfectly. But if we once clicked the “Export to Excel” button after words no any event gets working neither "Export to Excel" button itself.
After too many surfing, I found a link having great JavaScript solution as shown below:
<script type="text/javascript" language="javascript">Just posting this solution to my blog for further use.
//sharepoint postback to work after clicking on export to excel button
if (typeof (_spBodyOnLoadFunctionNames) != 'undefined' &&
_spBodyOnLoadFunctionNames != null) {
_spBodyOnLoadFunctionNames.push("supressSubmitWraper");
}
function supressSubmitWraper() {
_spSuppressFormOnSubmitWrapper = true;
}
</script>
No comments :
Post a Comment