是否有可能将布尔格式格式化为Telerik Grid中的字符串?MVC Telerik网格格式列布尔到字符串
我需要将布尔值(true/false)更改为字符串(是/否)。
我的模型:
[DataMember]
[DisplayName("PANDORA")]
public bool SeVePandora { get; set; }
[DataMember]
[DisplayName("PORTOS")]
public bool SeVePortos { get; set; }
[DataMember]
[DisplayName("CARRIER")]
public bool SeVeCarrier { get; set; }
[DataMember]
[DisplayName("CALCULADORA")]
public bool SeVeCalculadora { get; set; }
[DataMember]
[DisplayName("CONTROL STOCK")]
public bool SeVeControlStock { get; set; }
[DataMember]
[DisplayName("REMARKETING")]
public bool SeVeRemarketing { get; set; }
[DataMember]
[DisplayName("AUTO CREDIT")]
public bool SeVeAutocredit { get; set; }
[DataMember]
[DisplayName("VALORES RESIDUALES")]
public bool SeVeValoresResiduales { get; set; }
[DataMember]
[DisplayName("PRUEBAS")]
public bool EntornoPruebas { get; set; }
笔者认为:
<%= Html.Telerik().Grid<VWIS.DataModels.Models.AvisosPromociones.Avisos>()
.Name("ListAvisos")
.Columns(columna =>
{
columna.Bound(d => d.IdAViso).Visible(false).Sortable(false);
columna.Bound(d => d.Titulo).Width(380).Sortable(false);
columna.Bound(d => d.FechaInicio).Format("{0:dd/MM/yyyy}").Width(95).Sortable(true);
columna.Bound(d => d.FechaFin).Format("{0:dd/MM/yyyy}").Width(86).Sortable(true);
columna.Bound(d => d.SeVePandora).Width(50).Sortable(false);
columna.Bound(d => d.SeVePortos).Width(50).Sortable(false);
columna.Bound(d => d.EntornoPruebas).Width(50).Sortable(false);
columna.Bound(d => d.SeVeCarrier).Width(50).Sortable(false);
columna.Bound(d => d.SeVeCalculadora).Width(50).Sortable(false);
columna.Bound(d => d.SeVeControlStock).Width(50).Sortable(false);
columna.Bound(d => d.SeVeRemarketing).Width(50).Sortable(false);
columna.Bound(d => d.SeVeAutocredit).Width(50).Sortable(false);
columna.Bound(d => d.SeVeValoresResiduales).Width(50).Sortable(false);
}).DataBinding(datos => datos.Ajax().Select("_BusquedaAvisos", "Avisos", new { PrimeraBusqueda = true }))
.Pageable(page => page.PageSize(10))
.Selectable()
.Sortable()
.Reorderable(reorder => reorder.Columns(true))
.ClientEvents(e => e.OnDataBinding("OnDataBinding").OnRowSelect("SeleccionarFila"))
%>
在columna.Bound(d => d.SeVePandora).Format()
拉姆达表达式还不允许的。
有人可以帮助我吗?
我有同样的问题,我的代码,与你的一样,不起作用:columns.Bound(cb => cb.Status).Width(60).ClientTemplate( “<#if(Status == true){ #>” + “主动” + “<#}否则{#>” + “无效” + “<# } #>” );我收到一个JavaScript错误,指出“状态未定义”。如果我删除客户端模板,则布尔字段将正确呈现,尽管呈现的是真/假。 – SFAgitator