MVC Razor - add condition in toolbar template

2 posts, 0 answers
  1. Jonathan
    Jonathan avatar
    2 posts
    Member since:
    Apr 2013

    Posted 18 Apr 2013 Link to this post


    I want to add a condition for the toolbar template as follow:

     .ToolBar(toolbar =>
                            if(centre.AttributeCenterRels.Count < 6) {
                                @<div class="action text-align-right">
                                    <a href="~/AttributCentreRel/Create?CentreId=@centre.Id" class="btn"><i class="icon-plus"></i> Create</a>
                                @<div class="action text-align-right">
                                    Vous ne pouvez spécifier que 6 attributs pour un centre.

    Is this possible?

  2. Vladimir Iliev
    Vladimir Iliev avatar
    2199 posts

    Posted 19 Apr 2013 Link to this post

    Hi Jonathan,

     Please check the example below of creating such conditional template:

    .ToolBar(toolBar => toolBar.Template(@<text>
        @if(count > 5)
            <a href="javascript: void(0);" class="myClass">Click Here</a>

    Kind Regards,
    Vladimir Iliev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top