BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
I am using version 13.40.58
When exporting to Excel using the grid, the data does not get loaded & causes an error, it excludes the datasource.
Please advise.
Thanks
GridFeatures.cshtml
<script type="text/javascript">
function databound(args){
var grid = $('#FlatGrid').ejGrid('instance');
grid.ignoreOnExport.splice(grid.ignoreOnExport.indexOf('dataSource'), 1); // here we will splice dataSource property in ignoreOnExport method
}
</script>
GridController.cs
public void ExportToExcel(string GridModel)
{
ExcelExport exp = new ExcelExport();
GridProperties obj = ConvertGridObject(GridModel);
exp.Export(obj,(IEnumerable)(obj.DataSource), "Export.xlsx", ExcelVersion.Excel2010, false, false, "flat-saffron");
}
private GridProperties ConvertGridObject(string gridProperty)
{..
foreach (KeyValuePair<string, object> ds in div)
{
if (ds.Key == "dataSource")
{
string serialize = serializer.Serialize(ds.Value);
gridProp.DataSource = serializer.Deserialize<List<OrdersView>>(serialize); // here we need to deserialize tha dataSource (OrdersView as Class name)
}
..
return gridProp;
}
}
} |