在Kendo的ClientTemplate中嵌套条件的正确语法是什么?

时间:2015-11-11 22:22:03

标签: html kendo-ui kendo-grid kendo-asp.net-mvc client-templates

我尝试过多个网站/示例的各种组合,但无济于事。 Kendo没有嵌套条件的文档。我可以实现一个if / else条件没有问题,但嵌套一个给我问题。任何帮助实现这一点将不胜感激。

我在记事本++中对以下块进行了编码,因为它在眼睛上更容易......

"# 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>
    #}# 
#}#"

这是我在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>#}##}#");

0 个答案:

没有答案