[CLOSED] export to excel is not working

  1. #1

    [CLOSED] export to excel is not working

    When I am clicking on Export to Excel button it is just refreshing the grid and not at all opening excel sheet as mentioned in example. Required urgent help on same.
    PF below code:

    <%@ Page Language="C#" %>
    <%@ Import Namespace="System.Xml.Xsl" %>
    <%@ Import Namespace="System.Xml" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
         <script runat="server">
            private object permittype
                    return new object[]
                    new object[] { "Both", "Weight & Period"},
                    new object[] { "Period", "Period"},
                    new object[] { "Weight", "Weight"}
            private object transactionstatus
                    return new object[]
                    new object[] { 1, "Draft"},
                    new object[] {2, "Submitted"},
                    new object[] { 3, "Approved"}
            protected void ToExcel(object sender, EventArgs e)
                string json = JSON.Serialize(this.Store7.Data); //LIST to JSON ...
                StoreSubmitDataEventArgs eSubmit = new StoreSubmitDataEventArgs(json, null);
                XmlNode xml = eSubmit.Xml;
                this.Response.ContentType = "application/vnd.ms-excel";
                this.Response.AddHeader("Content-Disposition", "attachment; filename=submittedData.xls");
                XslCompiledTransform xtExcel = new XslCompiledTransform();
                xtExcel.Transform(xml, null, this.Response.OutputStream);
    <head id="Head2" runat="server">
            var saveData = function () {
                App.Hidden1.setValue(Ext.encode(App.GridPanel1.getRowsValues({ selectedOnly: false })));
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager2" runat="server" />
            <ext:Hidden ID="Hidden1" runat="server" />
            <ext:Store ID="Store7" runat="server" AutoLoad="true">
                                <ext:Parameter Name="start" Value="0" Mode="Raw" />
                                <ext:Parameter Name="limit" Value="10" Mode="Raw" />
                                <ext:RestProxy Url="~/CustomerRegistrationReport/GetData">
                                        <ext:JsonReader Root="data" MessageProperty="message" TotalProperty="total" />
                                <ext:Model ID="Model5" runat="server" IDProperty="Id" Name="WmsCustomerRegistrationReport">
                                        <ext:ModelField Name="Id" Type="Int" UseNull="true" />
                                        <ext:ModelField Name="CustomerName" Mapping="CustomerName" />
                                        <ext:ModelField Name="NetsuiteCustomerCode" Mapping="NetsuiteCustomerCode" />
                                        <ext:ModelField Name="CustomerContactName" />
                                         <ext:ModelField Name="CustomerEmail" />
                                          <ext:ModelField Name="DriverMobileNo" />
                                            <ext:ModelField Name="CustomerFax" />
                                              <ext:ModelField Name="CustomerPhoneOffice" />
                                                <ext:ModelField Name="CustomerContactName" />
                                                 <ext:ModelField Name="CustomerMobile" />
                                           <ext:ModelField Name="ApplicationRefNo" />
                                             <ext:ModelField Name="CustomerAddress" />
                                                   <ext:ModelField Name="City" />
                                                <ext:ModelField Name="Emirate" />
                                                  <ext:ModelField Name="Country" />
                                                     <ext:ModelField Name="TradeLicenseNo" />
                                                       <ext:ModelField Name="Customertype" Mapping="wmsCustomerTypeMaster.TypeDescription" />
                                                          <ext:ModelField Name="PermitNo" />
                                                             <ext:ModelField Name="Driver" />
                                                           <%--   <ext:ModelField Name="DriverMobileNo" />--%>
                                                              <ext:ModelField Name="VehicleType" />
                                                       <ext:ModelField Name="VehicleNo" />
                                                          <ext:ModelField Name="PermitType" />
                                                             <ext:ModelField Name="PermitCategory" />
                                                                <ext:ModelField Name="Status" />
                Title="Export Data"
                <ColumnModel ID="ColumnModel2" runat="server">
                       <ext:Column ID="Column5" runat="server" Text="ID" Width="40" DataIndex="Id" Hidden="true" />
                            <%--    <ext:Column ID="CustID" runat="server" Text="Customer ApplicationRefNo" DataIndex="ApplicationRefNo"
                            <ext:Column ID="Column7" runat="server" Text="Application RefNo." Width="110"
                            <ext:Column ID="Column8" runat="server" Text="NetsuiteCode" Width="100"
                            <ext:Column ID="Column9" runat="server" Text="Name" Width="140" DataIndex="CustomerName">
                            <ext:Column ID="Column10" runat="server" Text="Type" Width="100" DataIndex="Customertype">
                    <ext:RowSelectionModel ID="RowSelectionModel2" runat="server" Mode="Multi" />
                    <ext:Toolbar ID="Toolbar1" runat="server">
                            <ext:ToolbarFill ID="ToolbarFill2" runat="server" />
                            <ext:Button ID="Button2" runat="server" Text="To Excel" AutoPostBack="true" OnClick="ToExcel" Icon="PageExcel">
                                    <Click Fn="saveData" />
    Last edited by Daniil; Jul 23, 2013 at 1:55 PM. Reason: Please use [CODE] tags, [CLOSED]
  2. #2
    Hi @satyadev,

    I could not reproduce.

    To run the test case I had to replace
    with some valid URL on my side.

    Though it should not affect the exporting functionality.

    To test I used the latest Ext.NET from the trunk and FireFox.

Similar Threads

  1. Replies: 0
    Last Post: Jan 08, 2013, 6:18 AM
  2. Export to Excel
    By JonC in forum 1.x Help
    Replies: 9
    Last Post: Nov 13, 2012, 5:59 AM
  3. Excel Export
    By maephisto in forum 1.x Help
    Replies: 1
    Last Post: May 13, 2011, 12:47 PM
  4. Export to Excel not working
    By iltwams in forum 1.x Help
    Replies: 0
    Last Post: Sep 29, 2010, 10:16 PM
  5. vb example of export to Excel
    By grosenbrock in forum 1.x Help
    Replies: 2
    Last Post: Aug 27, 2010, 7:22 PM

Tags for this Thread

Posting Permissions