Monday, 20 January 2014

JQUERY Export To Excel HTML Content

exportPage.aspx

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="exportPage.aspx.cs" Inherits="_Default" %>





   

   

   

   


    Export to excel using jquery


Export to excel


   
      Name
      Age
      Email
   
   
      John
      44
      john@gmail.com
   
   
      Rambo
      33
      rambo@gmail.com
   
   
      It's hot
      33
      test@hotmail.com
   


   
   




exportPage.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void lnkExport_Click(object sender, EventArgs e)
    {
        string data = Request.Form["data"];
        data = HttpUtility.UrlDecode(data);
        Response.Clear();
        Response.AddHeader("content-disposition", "attachment;filename=report.xls");
        Response.Charset = "";
        Response.ContentType = "application/excel";
        HttpContext.Current.Response.Write(data);
        HttpContext.Current.Response.Flush();
        HttpContext.Current.Response.End();
    }
}


Tag:- Export To Excel,Export to Excel in Asp.net,Export Html Content,Export to Excel in .Net,Jquery Export To Excel,Asp.net Export To Excel,Export To PDF

No comments:

Post a Comment