We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Grid Export Generates script error

When clicking the grid export button the following error occures...
OnServerExcelExporting="ResultsEJGrid_ServerExcelExporting" AllowPaging="True">

 <ej:Grid ID="ResultsEJGrid" runat="server" AllowSorting="True"
          OnServerExcelExporting="ResultsEJGrid_ServerExcelExporting" AllowPaging="True">
          <DataManager URL="/api/Results/GetResultsPaged" Offline="false" Adaptor="UrlAdaptor"></DataManager>
          <GroupSettings EnableDropAreaAutoSizing="false" EnableDropAreaAnimation="true" ShowUngroupButton="true" CaptionFormat="#template"></GroupSettings>
          <ToolbarSettings ShowToolbar="true" ToolbarItems="excelExport,wordExport,pdfExport"></ToolbarSettings>
          <Columns>
            <ej:Column TemplateID="#caseLink" HeaderText="Id#" AllowEditing="False" TextAlign="Center" Width="6em" Field="ID_NB" />
          </Columns>
        </ej:Grid>
      </ContentTemplate>

Unhandled exception at line 10, column 9414 in http://localhost:3575/ScriptResource.axd?d=TAuAUGEcWnJSAEmaomvf4-8rVSng5fdQ6wyu7Qzs_gKymWMpfd-wP2g705SQlad65zDvPy0zic72UHKCXeZRq1fAT5noNFYaEihpOSFTBMKPdFZaQFIGG7IdW-2-QbnmDmV_O_CYjDPJCfUcmV9UM4o362angLoPV3cxaAWaPHZ3r7nzcBl6SJz7ER0E5lS70&t=ffffffffbdcbe025

0x800a138f - JavaScript runtime error: Unable to get property 'indexOf' of undefined or null reference

1 Reply

BM Balaji Marimuthu Syncfusion Team April 20, 2016 06:31 AM UTC

Hi Johnny,

Thanks for contacting Syncfusion support.

We have checked the reported issue by using the provided code snippets, but we were unable to reproduce the reported issue. So could you please try the attached sample and share following information.

Sample: Sample-F123768

1.     In provided code snippet, the Grid was rendered inside the content template. So we suspect that you are rendering Grid inside update panel. If you’re rendering Grid inside update panel and perform the export operation please ensure the following knowledge base document and code example.

                https://www.syncfusion.com/kb/5442

               


<asp:UpdatePanel runat="server" ID="UpdatePanel1">

            <ContentTemplate>

                <ej:Grid ID="FlatGrid" runat="server" AllowSorting="True"  OnServerExcelExporting="FlatGrid_ServerExcelExporting" AllowPaging="True">


                  . . .


                </ej:Grid>

            </ContentTemplate>

            <Triggers>

                <asp:PostBackTrigger ControlID="FlatGrid" />

            </Triggers>

        </asp:UpdatePanel>


2.     Ensure the dataSource is specified in the server exporting method, because while binding the remote data we need to specify the dataSource.


protected void FlatGrid_ServerExcelExporting(object sender, Syncfusion.JavaScript.Web.GridEventArgs e)

        {

            ExcelExport exp = new ExcelExport();

            FlatGrid.DataSource = new NorthwndDataContext().Orders.Take(50).ToList();

            exp.Export(FlatGrid.Model, (IEnumerable)FlatGrid.DataSource, "Export.xlsx", ExcelVersion.Excel2010, true, true, "flat-lime");


        }


3.     Essential studio and browser version details.

4.     Scenario to reproduce the issue and full code snippets of Grid default.aspx and code behind page.

5.      Share sample if possible or modify the attached sample as issue reproducible.


Regards,
Balaji Marimuthu


Loader.
Up arrow icon