views:

32

answers:

1

Hi, 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!

A: 

Try this: column.For(c => (c.Type.Equals("Type A") ? c.Type.AsClassAttribute() : c.Type));

CrazyDart
It doesn't work. Same output as I was getting, it shows on the table like class="Type A"
Nick Masao
can you please show the model class?
CrazyDart