【发布时间】:2018-03-09 21:43:48
【问题描述】:
有人可以通过 webgrid 帮助我查看以下视图
username location Date
a abc 12/10/2017
a def ↑ 12/10/2017
a def 12/10/2017
a def 12/11/2016
c abc 12/10/2017
username location Date
a abc 12/10/2017
a def ↓ 12/10/2017
a def 12/11/2016
c abc 12/10/2017
我已经在我的对象列表中的用户名/位置和日期字段上创建了组。但无法做出上述观点
我正在尝试关注
@{
var grid = new WebGrid(Model, canPage: false, rowsPerPage: 5, selectionFieldName: "selectedRow", ajaxUpdateContainerId: "gridContent");
<div id="gridContent">
@grid.GetHtml(tableStyle: "webGrid",
headerStyle: "header",
alternatingRowStyle: "alt",
selectedRowStyle: "select",
columns: grid.Columns(
grid.Column("Email", "User Name"),
grid.Column("location", "location"),
grid.Column("AccessedOn", "Date"),
grid.Column(format: (item) =>
{
if (item.count > 1)
{
WebGrid subGrid = new WebGrid(source: item.x);
return subGrid.GetHtml(tableStyle: "webGrid",
headerStyle: "header",
alternatingRowStyle: "alt",
selectedRowStyle: "select",
columns: grid.Columns(
grid.Column("Email", null),
grid.Column("location", null),
grid.Column("AccessedOn", null))
);
}
else
return null;
}
)
))
</div>
}
【问题讨论】:
标签: c# .net asp.net-mvc-5 webgrid