This question is locked. New answers and comments are not allowed.
Is it possible to programmatically create grid toolbar commands?
Instead of adding them manually as in the example below, I wish to pass down a collection of custom commands from my model and have the grid render them.
@(Html.Telerik().Grid<
QuotationItemViewModel
>()
.Name("quotationProductsGrid")
.DataKeys(keys => keys.Add(p => p.ID))
.ToolBar(commands =>
{
commands.Custom().HtmlAttributes(new { id = "btn-addproduct" }).Text("Add Product").HtmlAttributes(new { onclick = "addQuotationLine(" + Model.Id + ");return false;" });
commands.Custom().HtmlAttributes(new { id = "btn-recalculate" }).Text("Regulate lines").HtmlAttributes(new { onclick = "processSingleQuotationRegulation(" + Model.Id + ");return false;" });
commands.Custom().HtmlAttributes(new { id = "QuotationProfitabilityHolderTrigger" }).Text("-/+ Profit").HtmlAttributes(new { onclick = "$('#QuotationProfitabilityHolder').slideToggle('slow');return false;" });
})