Hide an element conditionally by its value

2019-09-21 02:33发布

问题:

I have a kendo grid containing following columns.

1.Name

2.Age

3.Type{values:public,private}

I need to hide a column in specific row. In my problem, i want to hide age cell if Type value is private.

回答1:

using if else format

 columns.Template(@<text></text>)
                        .ClientTemplate("#if (field == value) {#"
                        + "<a></a>"
                        + "#}else {#"
                        +"<input name='chkSubscribed' class='subscribedClass'type='type': '' #/>"
                        + "#} #").Width(130).Title("title");


回答2:

You can't hide the cell but you can hide the age depending of the other columns. See https://docs.telerik.com/aspnet-mvc/helpers/grid/faq#how-to-apply-conditional-logic-to-client-column-templates on how to apply conditional logic to columns?