1

I have tried various combinations from numerous sites/examples to no avail. Kendo does not have the documentation for a nested conditional. I can achieve an if/else conditional with no problem but nesting one is giving me issues. Any help in achieving this would be greatly appreciated.

I coded the following block in notepad++ because it is easier on the eyes...

"# if(IsPdf == true)
{#
    #if(UploadByID == @SessionWrapper.User.UserID)
    {#
        <div style='text-align:center; cursor:pointer '> 
            <a class=ActionbuttonDelete href='" + Url.Action("Index", "Customized") + "?ezFileID=#=EZFileID#'>[Markup Tools]</a>
            <a class=ActionbuttonDelete onclick=\"MyDeleteTemplate('#=EZFileID#')\">[Delete]</a>
        </div>
    #}

    else
    {#
        <div style='text-align:center; cursor:pointer '> 
            <a class=ActionbuttonDelete href='" + Url.Action("Index", "Customized") + "?ezFileID=#=EZFileID#'>[Markup Tools]</a>
            <a class=ActionbuttonDelete disabled onclick=\"MyDeleteTemplate('#=EZFileID#')\">[Delete]</a>
        </div>
    #}# 
#}#

else
{#
    #if(UploadByID == @SessionWrapper.User.UserID)
    {#
        <div style='text-align:center; cursor:pointer'> 
            <a class=ActionbuttonDelete onclick=\"MyDeleteTemplate('#=EZFileID#')\">[Delete]</a>
        </div> 
    #}

    else
    {#
        <div style='text-align:center; cursor:pointer'>
            <a class=ActionbuttonDelete disabled onclick=\"MyDeleteTemplate('#=EZFileID#')\">[Delete]</a>
        </div>
    #}# 
#}#"

and here is the code as it appears in my Kendo Grid...

column.Bound(p => p.EZFileID).Title("Action").Filterable(false).Sortable(false).ClientTemplate("# if(IsPdf == true){##if(UploadByID == @SessionWrapper.User.UserID){#<div style='textalign:center;cursor:pointer '><a class=ActionbuttonDelete href='" + Url.Action("Index", "Customized") + "?ezFileID=#=EZFileID#'>[Markup Tools]</a><a class=ActionbuttonDelete onclick=\"MyDeleteTemplate('#=EZFileID#')\">[Delete]</a></div>#}else{#<div style='text-align:center; cursor:pointer '> <a class=ActionbuttonDelete href='" + Url.Action("Index", "Customized") + "?ezFileID=#=EZFileID#'>[Markup Tools]</a><a class=ActionbuttonDelete disabled onclick=\"MyDeleteTemplate('#=EZFileID#')\">[Delete]</a></div>#}#    #}#else{##if(UploadByID == @SessionWrapper.User.UserID){#<div style='text-align:center; cursor:pointer'>    <a class=ActionbuttonDelete onclick=\"MyDeleteTemplate('#=EZFileID#')\">[Delete]</a></div> #}else{#<div style='text-align:center; cursor:pointer'><a class=ActionbuttonDelete disabled onclick=\"MyDeleteTemplate('#=EZFileID#')\">[Delete]</a></div>#}##}#");
MattParra
  • 291
  • 2
  • 14
  • 1
    Are you getting an invalid template error? – BillRuhl Nov 16 '15 at 16:33
  • Yes, I was but I actually solved the issue by separating the logic into a javascript method and passing the values back to the grid as Kendo formatted data. I never did get the syntax correct. I also wrote Kendo and was given a crappy half-assed answer which is usually what you get when you submit a support ticket with them. – MattParra Nov 16 '15 at 21:52
  • 1
    OK happy to hear you found a solution and yes the answers you get from them are nebular at best. Just a little FYI here is a template I copied from one of my projects "" use this as a example...its a column template but is from a grid that's nested inside a tabstrip that's nested in another grid! The invalid template error is coming from the hash tags you need to escape them with two "\\" i.e. "\\#" for every level of nesting. Hope that helps – BillRuhl Nov 16 '15 at 22:32

0 Answers0