I had a problem recently with being unable to export of gridview into excel when the grid was inside an AJAX update panel, plus the export button was also inside the panel. Took me a while to find the solution so I thought I would share it here.
Firstly lets deal with the problem of a grid being inside an AJAX panel, if your export button is also inside the panel your export function will probably give you the following error:
Sys.WebForms.PageRequestManagerParserErrorException
Or something along those lines. To fix this problem all you need to do is put a trigger inside your panel for a postback event on the button. Just make sure it as a postback event and not an asynchpostback. For example:
<triggers>
<asp:PostBackTrigger ControlID=”btnExcel” />
</triggers>
This should fix the problem. However if you are using a master page in your application you may still be getting problems with your export routine. To fix the problem add the following code to your aspx page code behind:
Public Overloads Overrides Sub VerifyRenderingInServerForm(ByVal control As Control) 'This code is required to export data from 'within an ajax update panel End Sub
Dont’ add anything inside the sub, just leave it as it is and this should work. Or if you prefer you can add the following code in your Master page code behind and it will work on any page.
Public Overloads Sub VerifyRenderingInServerForm(ByVal control As Control) 'This code is required to export data from 'within an ajax update panel End Sub
Hope this is of as much help to you as it was to me, feel free to comment.
Similar Posts
« Searching For Windows Based Blog Software Workaround bug with ASP.Net hyperlink control and Eval function »


Sharing of your knowledge is very well done. Ayax is very interesting. Program and its properties will increasingly be enriched. I’ve done in my HTML-PHP-MySQL program manually, coding. But the more information that you’v written has helped me to enrich my treasury. Thanks.