Click here to Skip to main content
14,877,782 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I want to export repeater having child grid views to excel. I bind child control inside the item data bound of repeater, and I wrote the code for exporting to excel, it shows excel but with no data
C#
protected void lnkPrint_Click(object sender, EventArgs e)
  {
      Response.Clear();
      Response.Buffer = true;
      Response.AddHeader("content-disposition", "attachment;filename=finance.xls");
      Response.Charset = "UTF-8";

      Response.ContentType = "application/vnd.ms-excel";
      System.IO.StringWriter stringWrite = new System.IO.StringWriter();
      System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
      rptProduct.RenderControl(htmlWrite);
      Response.Write("<table>");
      Response.Write(stringWrite.ToString());

      Response.Write("</table>");
      Response.End();
  }


Any help is appreciated.

Regards
chinnu
Posted
Updated 11-Oct-11 23:01pm
v2

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