Problem
When you are modifying Response with Response.Write() from control which is inside UpdatePanel you may receive an error "Message received from the server could not be parsed"
Solution
Solution is to add a trigger to UpdatePanel like this:
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnExportToExcel" />
</Triggers>
</asp:UpdatePanel>
This causes an UpdatePanel to refresh the page only in control specified in Triggers section