.ToolBar(toolbar =>{
toolbar.Template(@<
text
>
...
</
text
>);
})
I can also use this to add a default excel export button:
.ToolBar(toolbar => toolbar.Excel())
Is it possible to add the excel export button, then add template (buttons) after excel button?
or, we will have to use one template button and export excel file in code?
Thanks
10 Answers, 1 is accepted
Hello Reader,
When a template is used, you should directly include the excel export command button mark up to the template.
E.g.
<a class=
"k-button k-button-icontext k-grid-excel"
href=
"#"
><span class=
"k-icon k-i-excel"
></span>Export to Excel</a>
Dimiter Madjarov
Telerik

any other k-grid css class we can use? I want to add a refresh button to toolbar and want to have consistent look and feel.
Thanks
Hello Reader,
This is correct. Indeed you could use the same approach with any toolbar command e.g. create, save, cancel. Nevertheless the refresh command is part of the pager and cannot be added this way. As a workaround you could add a custom button and manually invoke the refresh method of the Grid API in it's click handler.
Regards,Dimiter Madjarov
Telerik


In grid onDataBound event put this line: this.element.data('kendoGrid').getOptions().excel or .pdf()
This will expose the properties which can then be manipulated via js/jQuery:
allPages false
fileName "Export.xlsx"
filterable false
proxyURL ""
Hello Donald,
These properties could be set directly in the Grid configuration via the excel configuration option.
Have a great day!
Regards,Dimiter Madjarov
Telerik

I am getting an error when i am adding toolbar.excel()
Error 3 'Kendo.Mvc.UI.Fluent.GridToolBarCommandFactory<SampleUIApp.Areas.ListPage.Models.AccntGroupModel>' does not contain a definition for 'Excel' and no extension method 'Excel' accepting a first argument of type 'Kendo.Mvc.UI.Fluent.GridToolBarCommandFactory<SampleUIApp.Areas.ListPage.Models.AccntGroupModel>' could be found (are you missing a using directive or an assembly reference?) d:\users\rasika.telang\TFS2013\SandBox\Projects\SampleUIApp\SampleUIApp\Areas\ListPage\Views\AccntGroup\IndexListPageExportExcel.cshtml 17 29 SampleUIApp
what do i do?
@Dimiter
Hello Rasika,
Please open a support ticket about the problem, so we could assist with the issue.
Regards,Dimiter Madjarov
Telerik

Can we hide the kendo grid exort to excel button for some users?
Hello Neema,
There is no built-in functionality that could be applied. A possible solution could be based on the user's role to enable/disable the excel export. Use the HtmlAttributes to add class "user".
@{
var user = "Admin";
}
.ToolBar(t => t.Excel().HtmlAttributes(new { @class = @user }))
and then apply a CSS style to:
.Admin {
display:none
}
Let me know in case you need further assistance.
Kind Regards, Silviya Stoyanova Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.