jquerycsskendo-gridkendo-asp.net-mvcclient-templates

add css to a cell through client template in a kendo grid


My cols are defind as belwo

x.Bound(y => y.IsStudentIn).Hidden(true);
x.Bound(y => y.Student).ClientTemplate("# if(IsStudentIn== false) {# <span style = \" background-color:red; \"></span>#}#");

if IsStudentIn = false, I want the Student cell to turn red color. Tried the above way, its not working. How to add css to this specific td


Solution

  • Here is the answer, I contacted telerik to get the answer

    x.Bound(y => y.IsStudentIn).Hidden(true);
    x.Bound(y => y.Student).ClientTemplate("# 
    if(IsStudentIn== false) 
              {#"+ "<div style='background:red;'/>#:Student # </div>" + "# } 
                     else {#" + 
                            "#: Student #" + 
                         "# } #");