开发者

Help with MvcContrib Column options

开发者 https://www.devze.com 2023-01-22 05:38 出处:网络
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

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));
0

精彩评论

暂无评论...
验证码 换一张
取 消