【发布时间】:2014-09-08 13:38:34
【问题描述】:
我试图仅根据名为 isPrimary 的值显示此删除按钮。如果 isPrimary 为 true,则不显示它。
问题是如何根据模型中的值有条件地显示最后一个?
这是我目前拥有的代码。
@(Html.Kendo().Grid(Model.GiIncidentReportList)
.Name("IRGrid")
.Columns(columns =>
{
columns.Bound(r => r.IncidentReport.IR_IncidentID)
.Template(@<text>@Html.Raw(@Html.ActionLink("[replacetext]", "Index", "ApprovalWorkflow",
new { area = "Dailylog", id = item.IncidentReport.IR_IncidentID, createdBy = item.IncidentReport.IR_CreatedByLoginID, isPrimaryReport = isPrimary }, null).ToHtmlString().Replace("[replacetext]", "<img src=\"/Images/icon_edit.gif\" />")) </text>)
.Title("").Width(70);
columns.Bound(r => r.IncidentReport.IR_CaseNumber).Title("Case Number");
columns.Bound(r => r.IncidentCreatedByName).Title("Created By");
columns.Bound(r => r.IncidentCreatedDateTime).Title("Created Date");
columns.Bound(r => r.IncidentUpdatedByName).Title("Updated By");
columns.Bound(r => r.IncidentUpdatedDateTime).Title("Updated Date");
columns.Template(p => @Html.ActionLink("Delete","DeleteIncidentReport","IncidentReport",
new { incidentReportId = p.IncidentReport.IR_IncidentID, dlLogId = p.IncidentReport.DL_LogID, incidentType = p.IncidentReport.IT_IncidentType },
new { @class = "k-button k-button-icontext", onclick = "return confirm('Are you sure you wish to delete this report?')" }).ToHtmlString()
);
}
)
)
【问题讨论】: