1
我想知道如何控制列是否在Html.Grid中可见,如果列表中没有返回任何内容。因此,如果在下面的示例中,Model.Comment在ExampleList中没有值,则不应呈现该列。MVC:如何仅在Html:Grid中存在值时才显示列?
@Html.Grid(Model.ExampleList).Columns(c =>
{
c.For(a => string.Format("{0:dd/MM/yyyy}", a.DateRequested)).Named("Date Requested");
c.For(a => a.Comment).Named("Comment");
c.For(a => a.Completed).Named("Completed");
})
这怎么能实现?