Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Export of ig grid data and summary data to PDF CSV and XML
posted

Hi,

Is there a way i can export the date from ig grid to PDF, XML, CSV. Curretnly i am using C# example provided by Infragistics to export data to PDF and JQuery to export data from ig Grid to CSV.

For XML we have written our own code to loop through the data stored in the Session to export to XML, but this is not going to work since the summary data will be in the grid which will not be available in the session. Please help.

Thanks,

Harish Kamath

  • 20255
    Offline posted

    Hey Harish, Thank you for contacting us!

    You might consider using our Grid Excel Exporter. This is a powerful component that allows you to export the data from the Grid as long as the summary elements associated with it.

    I am attaching a small sample that demonstrates the usage of the exporter, let me know if you have any other questions.

    @(Html.Infragistics()
    .Grid(Model)
    .ID("grid1")
    .PrimaryKey("ProductID")
    .AutoGenerateColumns(false)
    .EnableUTCDates(true)
    .UpdateUrl(Url.Action("SaveData"))
    .Columns(col =>
    {
        col.For(c => c.ProductID).HeaderText("ProductID");
        col.For(c => c.ReleaseDate).DataType("date").Format("dd/MM/yy h:mm").HeaderText("ReleaseDate");
    })
    .Features(feature =>
    {
        feature.Summaries();
    }).DataBind()
    .Render())

            function exportGrid() {
                $.ig.GridExcelExporter.exportGrid($("#grid1"), {
                    //columnsToSkip: ["ReleaseDate"],
                }, {
                    exportEnding: function (sender, args) {
                        args.worksheet.columns(1).setWidth(200, $.ig.excel.WorksheetColumnWidthUnit.pixel)
                    }
                })
            }

    igExcelExporter_Sample_MVC5.zip