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. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ExportExcelAction GridPropertiesModel Equivalent

Thread ID:

Created:

Updated:

Platform:

Replies:

116062 Mar 25,2014 08:50 PM UTC Mar 27,2014 06:23 AM UTC ASP.NET MVC (Classic) 1
loading
Tags: Grid
Thomas Kiehl
Asked On March 25, 2014 08:50 PM UTC

I need to know how to accomplish the mapping of additional parameters to the expel export in the GridProperties model.

This is what works in the GridBuilder
.Mappers(map =>
            {
                map.ExportExcelAction("ExportOrderDetails", new { account = Model.Order.CustomerNumber, orderNumber = Model.Order.OrderNumber });
            })
...

            .ToolBar(tools =>
                {
                    tools.Add(GridToolBarItems.ExcelExport);
                })

What is the equivalent of the above using the gridpropertiesmodel?

ToolbarSettings toolbar = new ToolbarSettings();
            toolbar.Enable = true;
            toolbar.Items.Add(new ToolbarOptions() { ItemType = GridToolBarItems.ExcelExport, Caption = "ExportOrderDetails", Mapper =  ?????});
            gridModel.ToolBar = toolbar;

Alan Sangeeth S [Syncfusion]
Replied On March 27, 2014 06:23 AM UTC

Hi Thomas,

Thanks for using Syncfusion Products.

We are glad to let you know that your requirement can be achieved by using clientside event “OnToolbarClickEvent”. In that event handler we can be bind values to ExcelToExport action. Please refer the following code snippets.

Code Snippet:

[CONTROLLER]

public ActionResult GridFeatures()

{


ClientSideEvents =
new ClientSideEvents() { OnToolbarClickEvent = "ToolbarClick" },



}

public ActionResult ExportToExcel(string CustomerID)

{

var data = new GridSample1.Models.StudentDataContext().Student.Take(100).ToList();

 

return data.GridExportToExcel<Student>("GridExcel.xlsx", ExcelVersion.Excel2007);
}

[JAVASCRIPT]

function ToolbarClick(sender, args) {

$('#GenericListGrid_exportExcel').append($('#CustomerID'));

}    

For your convenience we have created a sample and the same can be downloaded from below link.

Sample:

http://www.syncfusion.com/downloads/support/directtrac/121679/GridSample1-1459410709.zip


Please let us know if you have any queries.

Regards,
Alan Sangeeth S


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;