【发布时间】: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");
任何帮助或建议将不胜感激。
【问题讨论】: