This is a migrated thread and some comments may be shown as answers.

Load toolbar template from x-kendo-template

4 Answers 286 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Roland
Top achievements
Rank 1
Roland asked on 06 Jul 2012, 10:59 AM
Hi

How can i use the x-kendo-template for my grid toolbar?

Before I got something like this:
kendoGrid({
toolbar: kendo.template($("#toolbarTemplate").html())
});

and a corresponding script like:
<script type="text/x-kendo-template" id="toolbarTemplate">
  <div class="toolbar">
  </div>
</script>

how can i use the same template script inside asp.net mvc kendo ui grid
@(Html.Kendo().Grid(Of CProductionDataGridViewModel)().Name("datagrid").ToolBar(Sub(toolbar)
  toolbar.Template("kendo.template($('#toolbarTemplate').html()")
End Sub))

Thanks

4 Answers, 1 is accepted

Sort by
0
Vesselin Obreshkov
Top achievements
Rank 2
answered on 12 Jul 2012, 12:50 AM
I don't think you can do that from inside the MVC helpers. You need to do something like:

@(Html.Kendo().Grid<Model>()
   .ToolBar(toolBar => toolBar.Template(
   @<text>
        <div>Your template here</div>
   </text>
   )))
0
jaya
Top achievements
Rank 1
answered on 27 Nov 2012, 09:15 AM

Hi Vesselin Obreshkov
Its working for me.

Thanks
0
Kai
Top achievements
Rank 1
answered on 21 Feb 2013, 04:21 PM
+1 for this
0
Matt Miller
Top achievements
Rank 1
answered on 12 Nov 2013, 09:50 PM
i know this is an old thread, but is it possible to specify a template for a toolbar? or do you have to do it by surrounding the html in @<text></text>?
Tags
Grid
Asked by
Roland
Top achievements
Rank 1
Answers by
Vesselin Obreshkov
Top achievements
Rank 2
jaya
Top achievements
Rank 1
Kai
Top achievements
Rank 1
Matt Miller
Top achievements
Rank 1
Share this question
or