-1
我有這種說法如何插入條件,如果在WebGridColumn
查看
@model IEnumerable<xxxx>
@{
var idGrid = "grid" + this.ViewBag.IdParameters ?? string.Empty;
var grid = new WebGrid(id: idGrid, rowsPerPage: this.RowsPerPage, ajaxUpdateContainerId: idGrid);
byte Status = Convert.ToByte(ViewData["StatusM"]);
var columns = new WebGridColumn[] {
grid.Column("Id", ReuniaoResources.Id, style: "center"),
grid.DescriptionColumn("Status", ReuniaoResources.Status, descriptor: this.GetDescriptor(), style: "center"),
if(Status == 4)
{
grid.ButtonColumn(x => x.Status == 0 ? "ico_edit.gif" : "ico_details.gif",
toolTip: ReuniaoResources.Management,
showRoles: ApplicationRoles.xxxxx,
urlFunction: x => x.Status == 0 ? Url.Action("xxxx", "xxxxx", new {id = x.Id}) : Url.Action("xxxx", "xxxxx", new {id = x.Id})
);
}
grid.ViewButtonColumn(enableRoles: ApplicationRoles.xxxx, toolTip: Geral.Visualizar),
};
}
@grid.GetHtmlExtended(this.Model, this.RowsCount, page: this, columns: columns)
我想這ButtonColumn似乎只滿足如果條件
我做錯了什麼?
如何使它工作?
你不能有一個條件,如果在初始化網格。您的IF語句必須在初始化之外。 – Kami