Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have gridview data that i write in the excel file. its function is as,

C#
protected void btnExportToExcel_Click(object sender, EventArgs e)
    {
        try
        {
            Response.ClearContent();
            Response.Buffer = true;
            Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", "EmployeeAttendance.xls"));
            Response.ContentType = "application/ms-excel";
            StringWriter sw = new StringWriter();
            HtmlTextWriter htw = new HtmlTextWriter(sw);

            gvDisplayRecords.RenderControl(htw);
            Response.Write(sw.ToString());
            Response.End();
        }
        catch (Exception ex)
        {
            lblEmpAttError.Text = "" + ex.Message;
        }
    }


now i want to write single line under this gridview data. for the total days employee present and absent how can i write it.
Posted
Updated 20-Feb-12 23:03pm
v2

1 solution

Right after
C#
Response.Write(sw.ToString());
just add whatever you need into the Response.Write() before you do the Response.End().
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900