【发布时间】:2019-06-27 04:40:26
【问题描述】:
您好,我是 MVC 新手,我正在尝试对我的索引页面进行过滤,我希望能够过滤毕业状态。
因此,当我进入索引时,我会看到每个状态,并且我想过滤例如具有毕业状态或通过/失败状态的人
提前谢谢你!
控制器:
var graduates = db.Graduated_Students;
return View(graduates.ToList());
查看:
<div class="content-body">
<div class="row">
<form action="#" method="post">
<div class="col-xs-12 col-sm-9 col-md-12">
<table class="table">
<tr>
<th>
@Resource.FirstName
</th>
<th>
@Resource.LastName
</th>
<th>
@Resource.CohortNumber
</th>
<th>
Placements
</th>
<th>
@Resource.GraduationStatus
</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem =>
item.FirstName)
</td>
<td>
@Html.DisplayFor(modelItem =>
item.LastName)
</td>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem =>
item.PartnerName)
</td>
<td>
@Html.DisplayFor(modelItem =>
item.GraduationStatus)
</td>
【问题讨论】:
标签: c# html razor model-view-controller