-1

I have a kendo grid containing following columns.

1.Name

2.Age

3.Gender{checkbox(male, female)}

I need to hide a column in specific row. In my problem, want to hide Gender cell which contain checkbox if Age value equal to 18 or 19 or 20.

  • 1
    Possible duplicate of [Hide an element conditionally by its value](https://stackoverflow.com/questions/55949597/hide-an-element-conditionally-by-its-value) – Carsten Franke May 02 '19 at 12:38

2 Answers2

1

As @Carsten said, you can't hide a cell, but only hide it's content. You can use a template for that:

template: "# if (data.Age < 18 || data.Age > 20) { #<input type='checkbox' name='Gender'># } #"

Dojo

In your case, using Asp.Net MVC you should use ClientTemplate. Something like this(can't test it):

columns.Bound(p => p.Gender).ClientTemplate("# if (data.Age < 18 || data.Age > 20) { #<input type='checkbox' name='Gender'># } #")

Source 1, source 2, source 3

DontVoteMeDown
  • 21,122
  • 10
  • 69
  • 105
0

You can't hide the cell but you can hide the content 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.

Carsten Franke
  • 1,649
  • 2
  • 13
  • 30