This is a migrated thread and some comments may be shown as answers.
Programmatically creating grid toolbar commands
0 Answers 13 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nick
Top achievements
Rank 1
Nick asked on 29 May 2013, 01:22 PM

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;" });
              })
Tags
Grid
Asked by
Nick
Top achievements
Rank 1
Share this question
or