Excel download for a full webform RRS feed

  • Question

  • User219039814 posted

    I have a set of textboxes and 2 gridview, whose data is generated dynamically.

    Now i want to give download option, like a recepit format for the above data.

    is it possible.

    Tuesday, June 12, 2018 6:46 AM

All replies

  • User-330142929 posted

    Hi Vijaylakshmi,

    I have a set of textboxes and 2 gridview, whose data is generated dynamically.

    According to your description, I am not clear about your requirement. In my opinion, You seem to be wondering how to download dynamically generated gridviews by Excel. If I understand it wrong, please provide more details about your requirements to let me know and provide an effective solution will be easier.

    The following is my workaround, I hope it helps you. In the following demo program, I dynamically generate a GridView using button click events. Use the jquery plugin table2excel.js to export excel.


       <div runat="server" id="div1" style="border: 1px dashed #ff6a00;">
            <hr />
            <asp:Button ID="Button2" runat="server" Text="Generate" OnClick="Button2_Click" />
            <asp:Button ID="Button1" runat="server" Text="Download" />


    <script src="Scripts/jquery-3.3.1.min.js"></script>
        <script src="Scripts/jquery.table2excel.min.js"></script>
        <script type="text/javascript">
            $(function () {
                    exclude: ".noExl", 
                    name: "Excel Document Name", 
                    filename: "myFileName", 
                    exclude_img: true, 
                    exclude_links: true, 
                    exclude_inputs: true

    Code behind.

      protected void Button2_Click(object sender, EventArgs e)
                GridView gridView = new GridView();
                gridView.ID = "GridView1";
                gridView.DataSource = GetDataTable();
            protected DataTable GetDataTable()
                DataTable dt = new DataTable();
                DataRow dr = dt.NewRow();
                dr[0] = 1;
                dr[1] = "Apple";
                DataRow dr1 = dt.NewRow();
                dr1[0] = 2;
                dr1[1] = "Peach";
                return dt;

    How it works.

    How to use jquery plugin table2Excel.js, GitHub project host address.


    Please feel free to let me know if you have any question.


    Best Regards,


    Thursday, June 14, 2018 10:36 AM