If else in Web Grid Column
问题 How to put a condition (if else) in webgrid column? @grid.GetHtml(tableStyle: "table table-bordered", columns: grid.Columns( grid.Column("RealName", "Name"), grid.Column("UserName", "Email") )) I have to show the Email Column based on a condition, How to do this? 回答1: You can try this @{ var gridColumns = new List<WebGridColumn>(); gridColumns.Add(grid.Column(format: (item) => Html.ActionLink("Select", "Details"))); if (true) { gridColumns.Add(grid.Column(format: (item) => Html.ActionLink(