我正在尝试在网格内创建一个网格。在嵌套父网格之前它很好,但是当我尝试嵌套另一个网格时,它显示WebGrid.Colums
有一些无效的参数。我有以下代码
<div id="lgrid" class="tablesorter">
@{
var grid = new WebGrid(Model.AssetDetails, rowsPerPage: 20, canSort: false, canPage: false, ajaxUpdateContainerId: "1grid");
}
@grid.GetHtml(
tableStyle: "lgrid",
headerStyle: "head",
alternatingRowStyle: "alt",
columns: grid.Columns(
grid.Column("S.N.", format: @<text>@{count++;}@count</text>, style: "sn"),
grid.Column("Name", format: @<text>@item.Category.CategoryTitle</text>, style: "ItemNo"),
grid.Column("ItemDesc", format: @<text>@item.ItemDescription</text>, style: "ItemNo"),
grid.Column("Quantity", format: @<text>@item.Quantity</text>, style: "Quantity"),
grid.Column("Unit", format: @<text>@item.Unit.UnitSymbol</text>, style: "Unit"),
grid.Column("Unit Price", format: @<text>@item.UnitPriceUSD</text>, style: "UnitPrice"),
grid.Column("ExchangeRate", format: @<text>@item.ExchangeRate</text>, style: "ExchangeRate"),
grid.Column("NPR", format: @<text>@{NPR = (@item.UnitPriceUSD * @item.ExchangeRate);}@NPR</text>, style: "NPR"),
grid.Column("AssetDetails", format: (item) =>
{
WebGrid resGrid = new WebGrid(item.AssetDetails);
return resGrid.GetHtml(
columns: resGrid.Columns(
resGrid.Column("Parameters", format: (resource) =>
{
WebGrid resParamGrid = new WebGrid(resource.AssetDetails);
return resParamGrid.GetHtml(
columns: resParamGrid.Columns(
resParamGrid.Column("AssetNo", format: @<text>@newasst.AssetNo</text>),
resParamGrid.Column("SerialNo", format: @<text>@newasst.SerialNo</text>),
resParamGrid.Column("ModelNo", format: @<text>@newasst.ModelNo</text>),
resParamGrid.Column("Remarks", format: @<text>@newasst.Remarks</text>)
),
displayHeader: false
);
})
),
displayHeader: false
);
}),
))