0

我有一个 Telerik 网格,根据我的 IsTrue 值是真还是假,我需要将仅在该特定行中的名称文本的字体粗细设置为粗体。我尝试了以下方法,但似乎遗漏了一些东西。

columns.Bound(d => d.IsTrue).Width(0).HtmlAttributes(new { id="hdnIsTrue", style = "visibility:hidden;" });
columns.Bound(d => d.Name).ClientTemplate("#<#= hdnIsTrue ? font-weight : bold : font-weight : normal #>#" + "# } #")
                            .Title("Name").Width(200);
4

1 回答 1

0

在帖子的帮助下,我将代码修改为以下内容: Telerik MVC Grid making a Column Red Color based on Other Column Value

.Columns(columns =>
         {columns.Bound(d => d.IsTrue).Width(0);
          columns.Bound(d => d.Name).Title("Name).Width(200).HtmlAttributes(new { style = "font-weight:normal;" });

}).CellAction(cell => {
                        if (cell.Column.Title == "Name"){
                              var item = cell.DataItem;
                              if(item.IsTrue) {
                                  cell.HtmlAttributes["style"] = "font-weight : bold;";
                              }}}).Render();  
于 2015-06-15T11:26:11.903 回答