I am using the MVCContrib grid and I would like to add some html attributes to a cell depending on the value of a column. I need something like this
column.For(c => c.Type.Equals("Type A") ?
"show value and add attribute" : "just show value");
I tried this but it doesn't work. It shows the value on the grid as - class="Type A"
column.For(c => c.开发者_开发百科Type.Equals("Type A") ? c.Type.AsClassAttribute() : c.Type);
Please help. Thanks!
Try the following:
column.For(c => (c.Type.Equals("Type A") ? c.Type.AsClassAttribute() : c.Type));
精彩评论