When the grid is in Update Panel the partial post will be done and hence exporting will not work in grid.
Although we can achieve the Exporting using below two ways.
We can change the post back grid as post back control by using PostBackTrigger in the Default.aspx page. Now the grid will send post back on its operation and hence the export will work as expected.
Grid rendering control:
If we don’t want to use the grid as a post back control then we can save the exported file in the specified location instead of downloading.
We can set the “isLocalSave” property as true and also set the path for the property filePath of the Export method for saving the exported file in the specified file path.
Note: if the exported file exists already then the new file will be replaced in the same folder.
The above code example will work for both Word and PDF also.
Figure: Exported file
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:|
|5442||09/22/2015||09/22/2015||ASP.NET Web Forms||Grid|