You can put a button and can transfer your grid data to an excel file on click on that button and then can take print out.
protected void btnExport_Click(object sender, EventArgs e)
{
Response.Clear();
string strHeading = "";
//Response.AddHeader("content-disposition", "attachment; filename=ArchiveReport.xls");
Response.Charset = "";
// If you want the option to open the Excel file without saving than
// comment out the line below
// Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
if (gridArchiveViewGrid.Visible)
{
Response.AddHeader("content-disposition", "attachment; filename=ArchiveReport.xls");
strHeading = "<table class='TableFont' cellspacing='0' cellpadding='" + gridArchiveViewGrid.Columns.Count + "' style='background-color:#ccffff; border:0px;width:100%;' ><tr align='center'><TH colspan='" + gridArchiveViewGrid.Columns.Count + "'><b>LogicaCMG</b></TH></tr><tr align='center'><TH colspan='" + gridArchiveViewGrid.Columns.Count + "'><b>Archive report for period " + txt_FromDate.Value + " to " + txt_ToDate.Value + "</b></TH></tr></table>";
stringWrite.WriteLine(strHeading);
}
else
{
Response.AddHeader("content-disposition", "attachment; filename=Report_NotSubmitted.xls");
strHeading = "<table class='TableFont' cellspacing='0' cellpadding='" + gridYetToSubmitGrid.Columns.Count + "' style='background-color:#ccffff; border:0px;width:100%;' runat='server' ><tr align='center'><TH colspan='" + gridYetToSubmitGrid.Columns.Count + "'><b>LogicaCMG</b></TH></tr><tr align='center'><TH colspan='" + gridYetToSubmitGrid.Columns.Count + "'><b>report for Resource who has not submitted Timesheets for period " + txt_FromDate.Value + " to " + txt_ToDate.Value + "</b></TH></tr></table>";
stringWrite.WriteLine(strHeading);
}
System.Web.UI.HtmlTextWriter htmlWrite =
new HtmlTextWriter(stringWrite);
//gridArchiveViewGrid.RenderBeginTag(htmlWrite);
if (gridArchiveViewGrid.Visible)
{
gridArchiveViewGrid.RenderControl(htmlWrite);
}
else gridYetToSubmitGrid.RenderControl(htmlWrite);
//gridArchiveViewGrid.RenderEndTag(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}