我有以下表结构以方便我只添加了列名和数据行被删除。该表具有引导格式。
@model IEnumerable<eComm1.Models.ProductViewModel>
<div class="panel panel-default">
<table class="table">
<tr style="background-color:#00c8ff;color:#fff" >
<th>
@Html.DisplayNameFor(model => model.ProdCode)
</th>
<th>
@Html.DisplayNameFor(model => model.ProdName)
</th>
<th>
@Html.DisplayNameFor(model => model.BrandId)
</th>
<th>
@Html.DisplayNameFor(model => model.BrandName)
</th>
<th>
@Html.DisplayNameFor(model => model.CategoryId)
</th>
<th>
@Html.DisplayNameFor(model => model.CategoryName)
</th>
<th>
@Html.DisplayNameFor(model => model.ListPrice)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.ProdCode)
</td>
<td>
@Html.DisplayFor(modelItem => item.ProdName)
</td>
<td>
@Html.HiddenFor(modelItem => item.BrandId)
</td>
<td>
@Html.DisplayFor(modelItem => item.BrandName)
</td>
<td>
@Html.HiddenFor(modelItem => item.CategoryId)
</td>
<td>
@Html.DisplayFor(modelItem => item.CategoryName)
</td>
<td>
@Html.DisplayFor(modelItem => item.ListPrice)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.Id }) |
@Html.ActionLink("Details", "Details", new { id=item.Id }) |
@Html.ActionLink("Delete", "Delete", new { id=item.Id })
</td>
</tr>
}
</table>
</div>
如何隐藏列BrandId
和CategoryId
? {我已经更新了以上代码}