This example shows how to visually format the data in presented by Telerik Grid for ASP.NET MVC. Currently visual formatting works only in server binding mode.

You can use the RowAction method to format the entire row. It is executed for every single row of the grid.

<%= Html.Telerik().Grid(Model)
        .Name("Grid")
        .RowAction(row =>
        {
            // "DataItem" is the Order object to which the current row is bound to
            if (row.DataItem.Freight > 10)
            {
                //Set the background of the entire row
                row.HtmlAttributes["style"] = "background:red;";
            }
        });
%>

You can also use the CellAction method to format a concrete cell only. It is executed for every single cell of the grid.

<%= Html.Telerik().Grid(Model)
        .Name("Grid")
        .CellAction(cell =>
        {
            if (cell.Column.Name == "Freight")
            {
                if (cell.DataItem.Freight > 10)
                {
                    //Set the background of this cell only
                    cell.HtmlAttributes["style"] = "background:red;";
                }
            }
        });
%>