0
votes

I have a WebGrid tied to a model. In my model I have a field called "IsDuplicate" that if is true I need to change the color of the text for the entire row. Is there an easy way to do this like setting a TR css class or something similar? I don't want to have to format each column to add logic to it, that doesn't make sense.

Here is my current grid code:

@grid.GetHtml(
                tableStyle: "data",
                headerStyle: "head",
                columns: grid.Columns(
                    grid.Column("ItemNumber", header: "Item Number"),
                    grid.Column("ItemName", header: "Item Name"),
                    grid.Column("IsKicPresent", header: "KIC", format: @<text><input name="KIC" type="checkbox" value="@item.ItemNumber" disabled @(item.IsKicPresent ? "checked" : null) /></text>),
                    grid.Column("IsKpPresent", header: "KP", format: @<text><input name="KP" type="checkbox" value="@item.ItemNumber" disabled @(item.IsKpPresent ? "checked" : null) /></text>)));

Thanks,

Brent

1

1 Answers

0
votes

You will have to apply an if/then clause in your format parameter on each column to place data in a span set with a css style based on your data specifics.