简体   繁体   English

有关MvcContrib列选项的帮助

[英]Help with MvcContrib Column options

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. 我正在使用MVCContrib网格,并且我想根据列的值向单元格添加一些html属性。 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" 它在网格上显示为-class =“ Type A”

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

Please help. 请帮忙。 Thanks! 谢谢!

请尝试以下操作:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM