Export in to Excel

If you want to export data from grid view  or from database then the below code might be more suitable.In below code we create a dynamic grid with simple style and pass data source to get table data in to excel format and download it. protected void btn_excel_Click(object sender, EventArgs e) { Response.ClearContent(); Response.Charset = […]

Read More

Export to excel in jQuery

<%@ Page Title=”Home Page” Language=”C#” MasterPageFile=”~/Site.master” AutoEventWireup=”true” CodeFile=”Default.aspx.cs” Inherits=”_Default” %> <asp:Content ID=”HeaderContent” runat=”server” ContentPlaceHolderID=”HeadContent”> </asp:Content> <asp:Content ID=”BodyContent” runat=”server” ContentPlaceHolderID=”MainContent”> <script src=”http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.js” type=”text/javascript”></script> Export to excel using jquery <!–Here is jQuery code to add header in excel file–> <script type=”text/javascript”> $(document).ready(function () { $(“.expToExcel”).click(function () { var data = $(“#toReport”).html(); data = escape(data); $(‘body’).prepend(“<form method=’post’ action=’exportPage.aspx’ […]

Read More