Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MvcContrib grid conditional cell formatting based on model value

I need to conditional formatting a cell value based on a boolean value in the model. I have the column col.For(item => item.Detail); If item.Unfinished I need to apply some css style How can I do that?

like image 633
Rodrigo Juarez Avatar asked Feb 02 '23 22:02

Rodrigo Juarez


1 Answers

The answer is in my comment to the original post:

http://groups.google.com/group/mvccontrib-discuss/browse_thread/thread/f872d298cc9d53dc

column.For(x => x.Surname).Attributes(x => {
    if(x.Item.Surname == "foo") {
        return new Dictionary<string, object> { { "style", "color:red"} };
    }
    return new Dictionary<string, object>();
});
like image 128
Rodrigo Juarez Avatar answered May 01 '23 09:05

Rodrigo Juarez