GridView Export to Excel Problems

Several days back I wrote an article Exporting Datagrid to Excel, Word and Text Files. I tried the same technique for the GridView control and was smashed with a silly error saying that GridView control must be placed inside the Form tag with runat server = true. I switched to html view and found that GridView is already inside the form tag with runat = server. I googled it and found that many people are facing this problem and no one has found a solution yet. Microsoft has classified it as a "BUG". Here is a link to microsoft website about this BUG: GridView Export to Excel Bug I just got a direct link that talks about this BUG. You need to override Page.VerifyRenderingInServerForm Method to get it to work. Here is the msdn link which defines this method: GridView Excel Rendering Problem

Print | posted @ Monday, July 25, 2005 2:17 PM

Twitter