我宁愿为字符串或诠释,但基于位会解决它。Telerik的网格行自定义格式在任位/ INT /串场
目标是如果一个字符串字段的值=='等等等等等等',它会把整个行变成灰色(蓝色的表格已经使用红色和绿色,所以我打开任何其他颜色的建议)
我已经试过
.RowAction(row =>
{
if (row.DataItem.[Bound Data col Name] == "[String value]")
{
row.HtmlAttributes["style"] = "background:grey;";
}
})
和
.RowAction(row =>
{
if (row.DataItem.[Bound Data col Name] == "[String value]")
{
row.Grid.HtmlAttributes["style"] = "background:grey;";
}
})
和
.ClientEvents(events => events.OnRowDataBound("onRowDataBound"))
function onRowDataBound(e) {
if (e.dataItem.[Bound Data col Name] == "[String value]") {
e.row.style.backgroundColor = "grey";
}
}
所有这些并没有丝毫的工作,这些都为MVC如何做到这一点所以任何人有任何想法的唯一明显的例子?
哪部分不工作?值的匹配? 这部分应该工作: e.row.style.backgroundColor =“gray”; 尝试通过显示您试图比较的实际值进行调试。 – 2011-04-06 17:06:57
仍然不知道什么是错误的,但它现在起作用,以及客户端事件和jscript的作品,但只有当我加载了一个示例项目,我在telerik论坛上提供,然后它的工作。 – Myzifer 2011-04-07 08:47:10
因此,如果任何人有相同的神秘问题,那么http://www.telerik.com/community/forums/aspnet-mvc/grid/telerik-grid-row-custom-formatting-on-either-bit-int-string- field.aspx#1594253 – Myzifer 2011-04-07 09:39:24