protected void btnExport_Click(object sender, EventArgs e)
{
{
Response.ClearContent();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment;filename=Excel-Filename.xls");
Response.Charset = "";
Response.ContentType = "application/excel";
System.IO.StringWriter sw = new System.IO.StringWriter();
HtmlTextWriter htm = new HtmlTextWriter(sw);
rp_BindData.RenderControl(htm);
Response.Write(sw.ToString());
Response.End();
}
}
{
{
Response.ClearContent();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment;filename=Excel-Filename.xls");
Response.Charset = "";
Response.ContentType = "application/excel";
System.IO.StringWriter sw = new System.IO.StringWriter();
HtmlTextWriter htm = new HtmlTextWriter(sw);
rp_BindData.RenderControl(htm);
Response.Write(sw.ToString());
Response.End();
}
}
<asp:Button ID="btnExport" runat="server" Text="Export Excel" OnClick="btnExport_Click"/>Asp.net Repeater Export to Excel using c#
0 comments:
Post a Comment