I copied the excel demo and got the following message. I am not sure if it is b.c i am dynamically binding that data.
Excel export is not supported in server binding mode.
View
controller
Excel export is not supported in server binding mode.
View
@(Html.Kendo().Grid(Model)
.Name("grid")
.Columns(columns =>
{
foreach (System.Data.DataColumn column in Model.Columns)
{
var c = columns.Bound(column.ColumnName);
}
})
.ToolBar(tools => tools.Excel())
.Pageable()
.Sortable()
.Scrollable()
.Excel(excel => excel
.FileName("Export.xlsx")
.Filterable(true)
.ProxyURL(Url.Action("Excel_Export_Save", "Reports"))
)
.HtmlAttributes(new { style = "height:430px;" })
.DataSource(dataSource => dataSource
.Server()
.Model(model =>
{
foreach (System.Data.DataColumn column in Model.Columns)
{
var field = model.Field(column.ColumnName, column.DataType);
}
})
)
)
controller
[HttpPost]
public ActionResult Excel_Export_Save(string contentType, string base64, string fileName)
{
var fileContents = Convert.FromBase64String(base64);
return File(fileContents, contentType, fileName);
}