You can use a template so you can render the desired content (for example, a span with the desired color).
Here's a basic example, and a screenshot of the expected result is attached at the end of the post. Of course, you can refactor this to match your needs and coding style. The following article provides more details on how to use templates: https://docs.telerik.com/kendo-ui/framework/templates/overview.
view:
<style>
.red {
color: red;
}
.green {
color: green;
}
</style>
<script>
function getClass(id) {
return id < 5 ? "red" : "green";
}
function getClass2(name, fullDataItem) {
//console.log(fullDataItem.Id); // just an example how you can get the whole model so you can refactor this, or use more complex logic
public ActionResult GetData([DataSourceRequest] DataSourceRequest request)
{
return Json(
Enumerable.Range(1, 20)
.Select(x => new MyData { Id = x, Name = "name " + x })
.ToDataSourceResult(request)
);
}
Regards,
Marin Bratanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers.Learn More.