GridExcelBuilder
Methods
FileName(System.String)
Sets the file name of the excel file.
Parameters
fileName - System.String
If the parameter is set to true all pages will be exported
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.ToolBar(t => t.Excel())
.Excel(e => e.FileName("fileName"))
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
AllPages(System.Boolean)
Specifies whether all pages should be exported
Parameters
allPages - System.Boolean
If the parameter is set to true all pages will be exported
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.ToolBar(t => t.Excel())
.Excel(e => e.AllPages(true))
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
Filterable(System.Boolean)
Enables or disables filtering in the output Excel file.
Parameters
filterable - System.Boolean
The value for Filterable
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.ToolBar(t => t.Excel())
.Excel(e => e.Filterable(true))
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
ProxyURL(System.String)
Set the url of the server side proxy. The proxy is responsible for returning the excel file to the end user. Used in browsers that don't support saving files from JavaScript.
Parameters
url - System.String
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.ToolBar(t => t.Excel())
.Excel(e => e.ProxyURL("url"))
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
ForceProxy(System.Boolean)
Forces the use of server-side proxy even if the browser supports local saving.
Parameters
forceProxy - System.Boolean
true if the server proxy should be used always; false for automatic detection
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.ToolBar(t => t.Excel())
.Excel(e => e.ForceProxy(true))
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
Collapsible(System.Boolean)
Enables or disables collapsible (grouped) rows, for grids with aggregates.
Parameters
value - System.Boolean
The value for Collapsible
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.ToolBar(t => t.Excel())
.Excel(e => e.Collapsible(true))
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
Collapsible()
Enables or disables collapsible (grouped) rows, for grids with aggregates.
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.ToolBar(t => t.Excel())
.Excel(e => e.Collapsible(true))
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)