Click here to Skip to main content
13,152,454 members (39,277 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Helo friends.
In my website i m exporting gridview data excel.but the problem is gridview page footer also get exported in excel...i dont want to export that in to do it??
thx in advance..
Posted 23-Jan-13 20:14pm
shabari7 24-Jan-13 2:16am
better use epplus opensource for export to excel
shabari7 24-Jan-13 2:17am
or observe the viewsource of ur page,find the footer div/tr and try to remove the tr/div in javascript before exporting to excel
Balamurugan1989 24-Jan-13 2:18am
Right click the properties and change the Footer Setting.It will work.
Tadit Dash 24-Jan-13 2:22am
Please post your codes.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

private void ExportGridView()
            //gvFiles.ShowFooter = false;
            System.IO.StringWriter sw = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);
            gvFiles.FooterRow.Visible = false;
            // Render grid view control.
            // Write the rendered content to a file.
            string renderedGridView = sw.ToString();
            File.WriteAllText(@"D:\Suresh\ExportedFile.xls", renderedGridView);
           // gvFiles.ShowFooter = true;
            gvFiles.FooterRow.Visible = true;
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Make it hide while exporting
gvFiles.FooterRow.Visible = false;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170924.2 | Last Updated 24 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100