Color Row Based On Datasource

2 posts, 1 answers
  1. Joshua
    Joshua avatar
    12 posts
    Member since:
    Mar 2015

    Posted 08 May 2015 Link to this post

    I am trying to color a row based on the results that returned from the datasource.

    Is there a good clean way to accomplish this? The result comes back as a Hex value (not shown in the code below) so it can be a simple concatenation if needed in my MVC or Jquery. I just dont know the best way to perform this. Please help. Thanks


          .Columns(columns =>
              columns.Bound(ticket => ticket.RequesterId);
              columns.Bound(ticket => ticket.RequesterName);
              columns.Bound(ticket => ticket.TopicName);
              columns.Bound(ticket => ticket.Created).Format("{0:MM/dd/yyyy hh:mm tt}");
              columns.Bound(ticket => ticket.Id).Title("Actions").ClientTemplate("<button class=\"btn btn-primary\" onclick='location.href=\"/Ticket/Details/#=Id#\"'>Details</button>");
          .DataSource(dataSource => dataSource.Ajax().Read(read => read.Action("_MyOpenTickets_Read", "Ticket", new{ username = HttpContext.Current.Items["sAMAccountName"].ToString() }))
    <style scoped="scoped">
        .k-detail-cell .k-tabstrip .k-content {
            padding: 0.2em;

  2. Answer
    Dimiter Madjarov
    Dimiter Madjarov avatar
    2311 posts

    Posted 11 May 2015 Link to this post

    Hello Joshua,

    You could apply the custom styling in the dataBound event of the Grid. The approach is demonstrated in the following example.

    Dimiter Madjarov

    See What's Next in App Development. Register for TelerikNEXT.

Back to Top