【问题标题】:Displaying Bit Value as CheckBox in Telerik Grid在 Telerik Grid 中将位值显示为复选框
【发布时间】:2014-01-30 00:03:42
【问题描述】:

我有一个显示用户列表的 Telerik 网格。在我的数据库中,我有一个位字段来确定用户是否具有优先级。我在 Telerik 窗口中将其显示为复选标记时遇到问题。它总是以下拉列表的形式出现。我能够让它显示为文本框;但是,此选项不允许用户根据优先级手动分组。我尝试的第二种方法失败了,说“CS1660:无法将 lambda 表达式转换为类型“字符串”,因为它不是委托类型”,请参见下面的示例代码。

//the below example works fine, but it won't allow the user to sort. The automatic sort option is not available since it is an template.
 @* columns.Template(
              @<text> 
                    <input type="checkbox" name="prioprity" id="chkPriority" @(item.Users.PriorityUser == true ? "checked" : "unchecked") disabled="disabled"/> 
                </text>)
            .Width(60)
            .Title("Priority User");*@

 //The below example should  allow sorting. However, it throwing an exception 'CS1660: Cannot convert lambda expression to type 'string' because it is not a delegate type'

columns.Bound(x => x.Users.PriorityUser).Width(50)
            .ClientTemplate(
             @<text>
                <input type='checkbox' name='prioprity' id='chkPriority' @(item.User.PriorityUser == true ? "checked" : "unchecked")  disabled='disabled'/>
             </text>
            ).Title("Priority User")

//This attempt displays the data, but it is showing as a dropdown. 

columns.Bound(x => x.Users.PriorityUser).Width(50)
                .ClientTemplate("<input type='checkbox' name='prioprity' id='chkPriority'@(item.Users.PriorityUser == true ? 'checked' : 'unchecked')  disabled='disabled'/>"
                ).Title("Priority User");

任何帮助或建议将不胜感激。

【问题讨论】:

    标签: asp.net-mvc-3 telerik-mvc


    【解决方案1】:

    问题已解决。 columns.Bound(x =&gt; x.Users.PriorityUser).Width(50) 在我删除 .edmx 文件并重新创建后工作得很好。以前,我只是从数据库中进行更新以更新 .edmx 文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-10-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-25
      • 2018-02-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多