Load toolbar template from x-kendo-template

5 posts, 0 answers
  1. Roland
    Roland avatar
    17 posts
    Member since:
    Aug 2012

    Posted 06 Jul 2012 Link to this post

    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
  2. Vesselin Obreshkov
    Vesselin Obreshkov avatar
    81 posts
    Member since:
    Jan 2010

    Posted 11 Jul 2012 Link to this post

    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>
       )))
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. jaya
    jaya avatar
    1 posts
    Member since:
    Jun 2011

    Posted 27 Nov 2012 Link to this post


    Hi Vesselin Obreshkov
    Its working for me.

    Thanks
  5. Kai
    Kai avatar
    25 posts
    Member since:
    Jul 2012

    Posted 21 Feb 2013 Link to this post

    +1 for this
  6. Matt Miller
    Matt Miller avatar
    23 posts
    Member since:
    Jan 2012

    Posted 12 Nov 2013 Link to this post

    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>?
Back to Top
UI for ASP.NET MVC is VS 2017 Ready