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