I would like to be able to change the display value of a non-editable column on a non-editable Telerik AJAX grid in ASP.NET MVC. The column in question is a boolean value sot the display conversion would be Yes=true and No-False.
我希望能够在ASP.NET MVC中的不可编辑的Telerik AJAX网格上更改不可编辑列的显示值。有问题的列是一个布尔值,显示转换为Yes = true和No-False。
4 个解决方案
#1
6
I did a little experimenting and found this works. Not sure if it will hold up on an editable column but in my case the column is not editable.
我做了一点实验,发现这个有用。不确定它是否会阻止可编辑的列但在我的情况下该列不可编辑。
<% Html.Telerik().Grid<SomeClass>()
.Name("SomeGrid")
.Columns(columns =>
{
columns.Bound(o => o.ReportingPeriodShortDescription);
columns.Bound(o => o.Closed)
.ClientTemplate("<#=Closed ? 'Yes' : 'No' #>")
.Title("Closed")
.Width("4em");
})
.Footer(false)
.Render();
%>
#2
0
Use a template to convert the value from True/False to Yes/No. Here is an example of how to do so:
使用模板将值从True / False转换为Yes / No.以下是如何执行此操作的示例:
#3
0
I found an example on Telerik forums that walkthrough doing it based on server or client bindings.
我在Telerik论坛上找到了一个基于服务器或客户端绑定进行演练的示例。
http://www.telerik.com/community/forums/aspnet-mvc/grid/changing-a-bool-field-to-display-yes-no.aspx
In my case I'm using AJAX binding so I need a ClientTemplate:
在我的情况下,我正在使用AJAX绑定,所以我需要一个ClientTemplate:
columns.Bound(model => model.SubLimits).Title("Sublimits").Width(100)
.ClientTemplate("<#=SubLimits?'Yes':'No'#>");
#4
0
I struggled with this for a while - In my case the < > around the expression in the ClientTemplate didn't seem to work. I spotted the problem by viewing the generated html - it was generating tags such as <no></no>.
The following works fine for me:
我挣扎了一段时间 - 在我的情况下,ClientTemplate中表达式周围的<>似乎不起作用。我通过查看生成的html发现了问题 - 它生成的标签如
columns.Bound(c => c.DHSLane).Title("DHS Lane")
.ClientTemplate("#=DHSLane?'Yes':'No'#")
#1
6
I did a little experimenting and found this works. Not sure if it will hold up on an editable column but in my case the column is not editable.
我做了一点实验,发现这个有用。不确定它是否会阻止可编辑的列但在我的情况下该列不可编辑。
<% Html.Telerik().Grid<SomeClass>()
.Name("SomeGrid")
.Columns(columns =>
{
columns.Bound(o => o.ReportingPeriodShortDescription);
columns.Bound(o => o.Closed)
.ClientTemplate("<#=Closed ? 'Yes' : 'No' #>")
.Title("Closed")
.Width("4em");
})
.Footer(false)
.Render();
%>
#2
0
Use a template to convert the value from True/False to Yes/No. Here is an example of how to do so:
使用模板将值从True / False转换为Yes / No.以下是如何执行此操作的示例:
#3
0
I found an example on Telerik forums that walkthrough doing it based on server or client bindings.
我在Telerik论坛上找到了一个基于服务器或客户端绑定进行演练的示例。
http://www.telerik.com/community/forums/aspnet-mvc/grid/changing-a-bool-field-to-display-yes-no.aspx
In my case I'm using AJAX binding so I need a ClientTemplate:
在我的情况下,我正在使用AJAX绑定,所以我需要一个ClientTemplate:
columns.Bound(model => model.SubLimits).Title("Sublimits").Width(100)
.ClientTemplate("<#=SubLimits?'Yes':'No'#>");
#4
0
I struggled with this for a while - In my case the < > around the expression in the ClientTemplate didn't seem to work. I spotted the problem by viewing the generated html - it was generating tags such as <no></no>.
The following works fine for me:
我挣扎了一段时间 - 在我的情况下,ClientTemplate中表达式周围的<>似乎不起作用。我通过查看生成的html发现了问题 - 它生成的标签如
columns.Bound(c => c.DHSLane).Title("DHS Lane")
.ClientTemplate("#=DHSLane?'Yes':'No'#")