Hi.
I have the following grid:
@(Html.EJ().Grid<SlimHub.ViewModels.InvoiceCompetenceVM>
("InvoicesGrid")
.Datasource(ds => ds.Json((IEnumerable<SlimHub.ViewModels.InvoiceCompetenceVM>)Model))
.AllowMultiSorting()
.AllowFiltering()
.AllowSelection()
.AllowSorting()
.AllowGrouping()
.EnableHeaderHover()
.AllowResizing()
.AllowTextWrap(true)
.Locale("it-IT")
.GroupSettings(x => x.GroupedColumns(xf => { xf.Add("CompetenceYear"); }))
.ShowSummary()
.SummaryRow(row =>
{
row.Title("Totale Comp.").SummaryColumns(col => { col.SummaryType(SummaryType.Sum).Format("{0:C}").DisplayColumn("CompetenceAmount").DataMember("CompetenceAmount").Add();}).Add();
})
.FilterSettings(filter => { filter.FilterType(FilterType.Excel);})
.ToolbarSettings(toolBar => toolBar.ShowToolbar().ToolbarItems(items=>
{
items.AddTool(ToolBarItems.ExcelExport);
items.AddTool(ToolBarItems.WordExport);
items.AddTool(ToolBarItems.PdfExport);
}))
.Columns(col =>
{
col.Type("checkbox").Width(50).Add();
col.Field("InvoiceId").HeaderText("IDFattura").TextAlign(TextAlign.Center).Width(0).Visible(false).Add();
col.Field("InvoiceCode").HeaderText("Codice").TextAlign(TextAlign.Center).Width(200).Visible(true).Add();
col.Field("InvoiceYear").HeaderText("Anno").TextAlign(TextAlign.Center).Width(50).Visible(false).Add();
col.Field("InvoiceMonth").HeaderText("Mese").TextAlign(TextAlign.Center).Width(50).Visible(false).Add();
col.Field("CompetenceYear").HeaderText("AnnoComp.").TextAlign(TextAlign.Center).Width(50)Visible(true).Add();
col.Field("InvoiceNum").HeaderText("Num").TextAlign(TextAlign.Center).Width(50).Add();
col.Field("InvoiceSecondaryNum").HeaderText("Num").TextAlign(TextAlign.Center).Width(50).Add();
col.Field("CustomerName").HeaderText("Cliente").TextAlign(TextAlign.Center).Width(250).Add();
col.Field("CompetenceAmount").HeaderText("Tot.Competenza").TextAlign(TextAlign.Right).Format("{0:c2}").Width(85).Add();
})
.ClientSideEvents(eve =>
{
eve.RecordDoubleClick("onInvoiceRecordDoubleClick");
})
)
//VIEMODEL
namespace SlimHub.ViewModels
{
public class InvoiceCompetenceVM
{
public int InvoiceId { get; set; }
public string InvoiceCode { get; set; }
public int InvoiceYear { get; set; }
public int InvoiceMonth { get; set; }
public int CompetenceYear { get; set; }
public int? InvoiceNum { get; set; }
public string InvoiceSecondaryNum { get; set; }
public string CustomerName { get; set; }
public decimal? CompetenceAmount { get; set; }
}
}
//CONTROLLER
public void ExportToExcel(string GridModel)
{
ExcelExport exp = new ExcelExport();
GridProperties obj = (GridProperties)Syncfusion.JavaScript.Utils.DeserializeToModel(typeof(GridProperties),GridModel);
exp.Export(obj, (IEnumerable)(obj.DataSource),"ExportCompetenze.xlsx", ExcelVersion.Excel2010, false, false, "flat-saffron");//EXCEPTION!!!!
}
When I try to export by clicking on one of the buttons in the toolbar, I receive the following error:
System.ArgumentException
HResult=0x80070057
Messaggio='CompetenceYear' non è un membro del tipo 'System.Collections.Generic.KeyValuePair`2[System.String,System.Object]'
Origine=
Analisi dello stack:
I'm using version16.4460.0.42
Can you help me?
Thanks