C# NETMVC过滤
应用程序: ASP.NET MVC CRUD应用程序 Visual Studio 2013 完成: 通过将列(扇区)值呈现到下拉列表中创建筛选选项。因此,用户可以从下拉列表中选择一个扇区并单击SUBMIT以筛选表中的记录 要求: 根据列(扇区)值筛选表上的记录 在记录表中,假设列[Sector]has=> IT、管理、营销、abc、xyz、 需要像导航栏一样获取所有扇区值。单击此列表中的部门(市场营销)后,表应列出该部门(市场营销)的唯一记录 注意:用户能够插入新记录,因此能够创建新的扇区名称,因此呈现到导航栏的链接应该是动态的 由于我是该语言和MVC的新手,我不知道如何使用列表视图来代替下拉列表 控制器代码 PipelineController.cshtmlC# NETMVC过滤,c#,asp.net-mvc,razor,html-helper,C#,Asp.net Mvc,Razor,Html Helper,应用程序: ASP.NET MVC CRUD应用程序 Visual Studio 2013 完成: 通过将列(扇区)值呈现到下拉列表中创建筛选选项。因此,用户可以从下拉列表中选择一个扇区并单击SUBMIT以筛选表中的记录 要求: 根据列(扇区)值筛选表上的记录 在记录表中,假设列[Sector]has=> IT、管理、营销、abc、xyz、 需要像导航栏一样获取所有扇区值。单击此列表中的部门(市场营销)后,表应列出该部门(市场营销)的唯一记录 注意:用户能够插入新记录,因此能够创建新的扇区名称,
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using PipelineApp.Models;
namespace PipelineApp.Controllers
{
public class PipelineController : Controller
{
private PipelineEntities db = new PipelineEntities();
// GET: /Pipeline/
//public ActionResult Index()
//{
// return View(db.Pipelinedatas.ToList());
//}
//CUSTOM GET: /Pipelinedata/Sector filtering
//public ActionResult Index(string sector)
//{
// ViewBag.Sector = (from r in db.Pipelinedatas
// select r.Sector).Distinct();
// var model = from r in db.Pipelinedatas
// where r.Sector == sector || sector == null || sector == ""
// select r;
// return View(model);
//}
//CUSTOM GET: /Pipelinedata/ Sector Filtering/ Sort Order
public ActionResult Index(string sector, string sortOrder, int? page)
{
//Filter Secors ------------------------------
ViewBag.Sector = (from r in db.Pipelinedatas
select r.Sector).Distinct();
//---------------------------------------------
var model = from r in db.Pipelinedatas
where r.Sector == sector || sector == null || sector == ""
select r;
//Sort Order ----------------------------------
ViewBag.CurrentSort = sortOrder; //Paging
ViewBag.EmployerSortParm = String.IsNullOrEmpty(sortOrder) ? "emp_name" : "";
ViewBag.ITOSortParm = String.IsNullOrEmpty(sortOrder) ? "ITO" : "";
ViewBag.JanSortParm = String.IsNullOrEmpty(sortOrder) ? "January" : "";
ViewBag.FebSortParm = String.IsNullOrEmpty(sortOrder) ? "February" : "";
ViewBag.MarSortParm = String.IsNullOrEmpty(sortOrder) ? "March" : "";
ViewBag.AprSortParm = String.IsNullOrEmpty(sortOrder) ? "April" : "";
ViewBag.MaySortParm = String.IsNullOrEmpty(sortOrder) ? "May" : "";
ViewBag.JunSortParm = String.IsNullOrEmpty(sortOrder) ? "June" : "";
ViewBag.JulSortParm = String.IsNullOrEmpty(sortOrder) ? "July" : "";
ViewBag.AugSortParm = String.IsNullOrEmpty(sortOrder) ? "August" : "";
ViewBag.SepSortParm = String.IsNullOrEmpty(sortOrder) ? "September" : "";
ViewBag.OctSortParm = String.IsNullOrEmpty(sortOrder) ? "October" : "";
ViewBag.NovSortParm = String.IsNullOrEmpty(sortOrder) ? "November" : "";
ViewBag.DecSortParm = String.IsNullOrEmpty(sortOrder) ? "December" : "";
ViewBag.SectorSortParm = sortOrder == "sec" ? "ITO" : "sec";
switch (sortOrder)
{
case "emp_name":
model = model.OrderByDescending(s => s.Employer);
break;
case "sec":
model = model.OrderBy(s => s.Sector);
break;
case "ITO":
model = model.OrderByDescending(s => s.ITONumber);
break;
case "January":
model = model.OrderByDescending(s => s.Jan);
break;
case "February":
model = model.OrderByDescending(s => s.Feb);
break;
case "March":
model = model.OrderByDescending(s => s.Mar);
break;
case "April":
model = model.OrderByDescending(s => s.Apr);
break;
case "May":
model = model.OrderByDescending(s => s.May);
break;
case "June":
model = model.OrderByDescending(s => s.Jun);
break;
case "July":
model = model.OrderByDescending(s => s.Jul);
break;
case "August":
model = model.OrderByDescending(s => s.Aug);
break;
case "September":
model = model.OrderByDescending(s => s.Sep);
break;
case "October":
model = model.OrderByDescending(s => s.Oct);
break;
case "November":
model = model.OrderByDescending(s => s.Nov);
break;
case "December":
model = model.OrderByDescending(s => s.Dec);
break;
default:
model = model.OrderBy(s => s.Id);
break;
}
//---------------------------------------------
//Paging --------------------------------------
//int pageSize = 3;
//int pageNumber = (page ?? 1);
//return View(model.ToPagedList(pageNumber, pageSize));
//---------------------------------------------
return View(model);
}
// GET: /Pipeline/Details/5
public ActionResult Details(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Pipelinedata pipelinedata = db.Pipelinedatas.Find(id);
if (pipelinedata == null)
{
return HttpNotFound();
}
return View(pipelinedata);
}
// GET: /Pipeline/Create
public ActionResult Create()
{
return View();
}
// POST: /Pipeline/Create
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include="Id,Employer,ITONumber,Description,TECNumber,TECVersion,Level,Credits,Duration,Sector,Status,Approval,Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec")] Pipelinedata pipelinedata)
{
if (ModelState.IsValid)
{
db.Pipelinedatas.Add(pipelinedata);
db.SaveChanges();
return RedirectToAction("Index");
}
return View(pipelinedata);
}
// GET: /Pipeline/Edit/5
public ActionResult Edit(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Pipelinedata pipelinedata = db.Pipelinedatas.Find(id);
if (pipelinedata == null)
{
return HttpNotFound();
}
return View(pipelinedata);
}
// POST: /Pipeline/Edit/5
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Edit([Bind(Include="Id,Employer,ITONumber,Description,TECNumber,TECVersion,Level,Credits,Duration,Sector,Status,Approval,Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec")] Pipelinedata pipelinedata)
{
if (ModelState.IsValid)
{
db.Entry(pipelinedata).State = EntityState.Modified;
db.SaveChanges();
return RedirectToAction("Index");
}
return View(pipelinedata);
}
// GET: /Pipeline/Delete/5
public ActionResult Delete(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Pipelinedata pipelinedata = db.Pipelinedatas.Find(id);
if (pipelinedata == null)
{
return HttpNotFound();
}
return View(pipelinedata);
}
// POST: /Pipeline/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public ActionResult DeleteConfirmed(int id)
{
Pipelinedata pipelinedata = db.Pipelinedatas.Find(id);
db.Pipelinedatas.Remove(pipelinedata);
db.SaveChanges();
return RedirectToAction("Index");
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
db.Dispose();
}
base.Dispose(disposing);
}
}
}
@model IEnumerable<PipelineApp.Models.Pipelinedata>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
@using (Html.BeginForm())
{
<text> Sectors </text>
@Html.DropDownList("sector", new SelectList(ViewBag.Sector))
<input class="btn" type="submit" value="Filter" />
}
<p>
@Html.ActionLink("Create New", "Create")
</p>
<table class="table">
<tr>
<th>
@Html.ActionLink("Employer", "Index", new { sortOrder = ViewBag.EmployerSortParm })
@*@Html.DisplayNameFor(model => model.Employer)*@
</th>
<th>
@Html.ActionLink("ITONumber", "Index", new { sortOrder = ViewBag.ITOSortParm })
@*@Html.DisplayNameFor(model => model.ITONumber)*@
</th>
<th>
@Html.DisplayNameFor(model => model.Description)
</th>
<th>
@Html.DisplayNameFor(model => model.TECNumber)
</th>
<th>
@Html.DisplayNameFor(model => model.TECVersion)
</th>
<th>
@Html.DisplayNameFor(model => model.Level)
</th>
<th>
@Html.DisplayNameFor(model => model.Credits)
</th>
<th>
@Html.DisplayNameFor(model => model.Duration)
</th>
<th>
@Html.ActionLink("Sector", "Index", new { sortOrder = ViewBag.SectorSortParm })
@*@Html.DisplayNameFor(model => model.Sector)*@
</th>
<th>
@Html.DisplayNameFor(model => model.Status)
</th>
<th>
@Html.DisplayNameFor(model => model.Approval)
</th>
<th>
@Html.ActionLink("Jan", "Index", new { sortOrder = ViewBag.JanSortParm })
@*@Html.DisplayNameFor(model => model.Jan)*@
</th>
<th>
@Html.ActionLink("Feb", "Index", new { sortOrder = ViewBag.FebSortParm })
@*@Html.DisplayNameFor(model => model.Feb)*@
</th>
<th>
@Html.ActionLink("Mar", "Index", new { sortOrder = ViewBag.MarSortParm })
@*@Html.DisplayNameFor(model => model.Mar)*@
</th>
<th>
@Html.ActionLink("Apr", "Index", new { sortOrder = ViewBag.AprSortParm })
@*@Html.DisplayNameFor(model => model.Apr)*@
</th>
<th>
@Html.ActionLink("May", "Index", new { sortOrder = ViewBag.MaySortParm })
@*@Html.DisplayNameFor(model => model.May)*@
</th>
<th>
@Html.ActionLink("Jun", "Index", new { sortOrder = ViewBag.JunSortParm })
@*@Html.DisplayNameFor(model => model.Jun)*@
</th>
<th>
@Html.ActionLink("Jul", "Index", new { sortOrder = ViewBag.JulSortParm })
@*@Html.DisplayNameFor(model => model.Jul)*@
</th>
<th>
@Html.ActionLink("Aug", "Index", new { sortOrder = ViewBag.AugSortParm })
@*@Html.DisplayNameFor(model => model.Aug)*@
</th>
<th>
@Html.ActionLink("Sep", "Index", new { sortOrder = ViewBag.SepSortParm })
@*@Html.DisplayNameFor(model => model.Sep)*@
</th>
<th>
@Html.ActionLink("Oct", "Index", new { sortOrder = ViewBag.OctSortParm })
@*@Html.DisplayNameFor(model => model.Oct)*@
</th>
<th>
@Html.ActionLink("Nov", "Index", new { sortOrder = ViewBag.NovSortParm })
@*@Html.DisplayNameFor(model => model.Nov)*@
</th>
<th>
@Html.ActionLink("Dec", "Index", new { sortOrder = ViewBag.DecSortParm })
@*@Html.DisplayNameFor(model => model.Dec)*@
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Employer)
</td>
<td>
@Html.DisplayFor(modelItem => item.ITONumber)
</td>
<td>
@Html.DisplayFor(modelItem => item.Description)
</td>
<td>
@Html.DisplayFor(modelItem => item.TECNumber)
</td>
<td>
@Html.DisplayFor(modelItem => item.TECVersion)
</td>
<td>
@Html.DisplayFor(modelItem => item.Level)
</td>
<td>
@Html.DisplayFor(modelItem => item.Credits)
</td>
<td>
@Html.DisplayFor(modelItem => item.Duration)
</td>
<td>
@Html.DisplayFor(modelItem => item.Sector)
</td>
<td>
@Html.DisplayFor(modelItem => item.Status)
</td>
<td>
@Html.DisplayFor(modelItem => item.Approval)
</td>
<td>
@Html.DisplayFor(modelItem => item.Jan)
</td>
<td>
@Html.DisplayFor(modelItem => item.Feb)
</td>
<td>
@Html.DisplayFor(modelItem => item.Mar)
</td>
<td>
@Html.DisplayFor(modelItem => item.Apr)
</td>
<td>
@Html.DisplayFor(modelItem => item.May)
</td>
<td>
@Html.DisplayFor(modelItem => item.Jun)
</td>
<td>
@Html.DisplayFor(modelItem => item.Jul)
</td>
<td>
@Html.DisplayFor(modelItem => item.Aug)
</td>
<td>
@Html.DisplayFor(modelItem => item.Sep)
</td>
<td>
@Html.DisplayFor(modelItem => item.Oct)
</td>
<td>
@Html.DisplayFor(modelItem => item.Nov)
</td>
<td>
@Html.DisplayFor(modelItem => item.Dec)
</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>
视图代码
Index.cshtml
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using PipelineApp.Models;
namespace PipelineApp.Controllers
{
public class PipelineController : Controller
{
private PipelineEntities db = new PipelineEntities();
// GET: /Pipeline/
//public ActionResult Index()
//{
// return View(db.Pipelinedatas.ToList());
//}
//CUSTOM GET: /Pipelinedata/Sector filtering
//public ActionResult Index(string sector)
//{
// ViewBag.Sector = (from r in db.Pipelinedatas
// select r.Sector).Distinct();
// var model = from r in db.Pipelinedatas
// where r.Sector == sector || sector == null || sector == ""
// select r;
// return View(model);
//}
//CUSTOM GET: /Pipelinedata/ Sector Filtering/ Sort Order
public ActionResult Index(string sector, string sortOrder, int? page)
{
//Filter Secors ------------------------------
ViewBag.Sector = (from r in db.Pipelinedatas
select r.Sector).Distinct();
//---------------------------------------------
var model = from r in db.Pipelinedatas
where r.Sector == sector || sector == null || sector == ""
select r;
//Sort Order ----------------------------------
ViewBag.CurrentSort = sortOrder; //Paging
ViewBag.EmployerSortParm = String.IsNullOrEmpty(sortOrder) ? "emp_name" : "";
ViewBag.ITOSortParm = String.IsNullOrEmpty(sortOrder) ? "ITO" : "";
ViewBag.JanSortParm = String.IsNullOrEmpty(sortOrder) ? "January" : "";
ViewBag.FebSortParm = String.IsNullOrEmpty(sortOrder) ? "February" : "";
ViewBag.MarSortParm = String.IsNullOrEmpty(sortOrder) ? "March" : "";
ViewBag.AprSortParm = String.IsNullOrEmpty(sortOrder) ? "April" : "";
ViewBag.MaySortParm = String.IsNullOrEmpty(sortOrder) ? "May" : "";
ViewBag.JunSortParm = String.IsNullOrEmpty(sortOrder) ? "June" : "";
ViewBag.JulSortParm = String.IsNullOrEmpty(sortOrder) ? "July" : "";
ViewBag.AugSortParm = String.IsNullOrEmpty(sortOrder) ? "August" : "";
ViewBag.SepSortParm = String.IsNullOrEmpty(sortOrder) ? "September" : "";
ViewBag.OctSortParm = String.IsNullOrEmpty(sortOrder) ? "October" : "";
ViewBag.NovSortParm = String.IsNullOrEmpty(sortOrder) ? "November" : "";
ViewBag.DecSortParm = String.IsNullOrEmpty(sortOrder) ? "December" : "";
ViewBag.SectorSortParm = sortOrder == "sec" ? "ITO" : "sec";
switch (sortOrder)
{
case "emp_name":
model = model.OrderByDescending(s => s.Employer);
break;
case "sec":
model = model.OrderBy(s => s.Sector);
break;
case "ITO":
model = model.OrderByDescending(s => s.ITONumber);
break;
case "January":
model = model.OrderByDescending(s => s.Jan);
break;
case "February":
model = model.OrderByDescending(s => s.Feb);
break;
case "March":
model = model.OrderByDescending(s => s.Mar);
break;
case "April":
model = model.OrderByDescending(s => s.Apr);
break;
case "May":
model = model.OrderByDescending(s => s.May);
break;
case "June":
model = model.OrderByDescending(s => s.Jun);
break;
case "July":
model = model.OrderByDescending(s => s.Jul);
break;
case "August":
model = model.OrderByDescending(s => s.Aug);
break;
case "September":
model = model.OrderByDescending(s => s.Sep);
break;
case "October":
model = model.OrderByDescending(s => s.Oct);
break;
case "November":
model = model.OrderByDescending(s => s.Nov);
break;
case "December":
model = model.OrderByDescending(s => s.Dec);
break;
default:
model = model.OrderBy(s => s.Id);
break;
}
//---------------------------------------------
//Paging --------------------------------------
//int pageSize = 3;
//int pageNumber = (page ?? 1);
//return View(model.ToPagedList(pageNumber, pageSize));
//---------------------------------------------
return View(model);
}
// GET: /Pipeline/Details/5
public ActionResult Details(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Pipelinedata pipelinedata = db.Pipelinedatas.Find(id);
if (pipelinedata == null)
{
return HttpNotFound();
}
return View(pipelinedata);
}
// GET: /Pipeline/Create
public ActionResult Create()
{
return View();
}
// POST: /Pipeline/Create
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include="Id,Employer,ITONumber,Description,TECNumber,TECVersion,Level,Credits,Duration,Sector,Status,Approval,Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec")] Pipelinedata pipelinedata)
{
if (ModelState.IsValid)
{
db.Pipelinedatas.Add(pipelinedata);
db.SaveChanges();
return RedirectToAction("Index");
}
return View(pipelinedata);
}
// GET: /Pipeline/Edit/5
public ActionResult Edit(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Pipelinedata pipelinedata = db.Pipelinedatas.Find(id);
if (pipelinedata == null)
{
return HttpNotFound();
}
return View(pipelinedata);
}
// POST: /Pipeline/Edit/5
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Edit([Bind(Include="Id,Employer,ITONumber,Description,TECNumber,TECVersion,Level,Credits,Duration,Sector,Status,Approval,Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec")] Pipelinedata pipelinedata)
{
if (ModelState.IsValid)
{
db.Entry(pipelinedata).State = EntityState.Modified;
db.SaveChanges();
return RedirectToAction("Index");
}
return View(pipelinedata);
}
// GET: /Pipeline/Delete/5
public ActionResult Delete(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Pipelinedata pipelinedata = db.Pipelinedatas.Find(id);
if (pipelinedata == null)
{
return HttpNotFound();
}
return View(pipelinedata);
}
// POST: /Pipeline/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public ActionResult DeleteConfirmed(int id)
{
Pipelinedata pipelinedata = db.Pipelinedatas.Find(id);
db.Pipelinedatas.Remove(pipelinedata);
db.SaveChanges();
return RedirectToAction("Index");
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
db.Dispose();
}
base.Dispose(disposing);
}
}
}
@model IEnumerable<PipelineApp.Models.Pipelinedata>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
@using (Html.BeginForm())
{
<text> Sectors </text>
@Html.DropDownList("sector", new SelectList(ViewBag.Sector))
<input class="btn" type="submit" value="Filter" />
}
<p>
@Html.ActionLink("Create New", "Create")
</p>
<table class="table">
<tr>
<th>
@Html.ActionLink("Employer", "Index", new { sortOrder = ViewBag.EmployerSortParm })
@*@Html.DisplayNameFor(model => model.Employer)*@
</th>
<th>
@Html.ActionLink("ITONumber", "Index", new { sortOrder = ViewBag.ITOSortParm })
@*@Html.DisplayNameFor(model => model.ITONumber)*@
</th>
<th>
@Html.DisplayNameFor(model => model.Description)
</th>
<th>
@Html.DisplayNameFor(model => model.TECNumber)
</th>
<th>
@Html.DisplayNameFor(model => model.TECVersion)
</th>
<th>
@Html.DisplayNameFor(model => model.Level)
</th>
<th>
@Html.DisplayNameFor(model => model.Credits)
</th>
<th>
@Html.DisplayNameFor(model => model.Duration)
</th>
<th>
@Html.ActionLink("Sector", "Index", new { sortOrder = ViewBag.SectorSortParm })
@*@Html.DisplayNameFor(model => model.Sector)*@
</th>
<th>
@Html.DisplayNameFor(model => model.Status)
</th>
<th>
@Html.DisplayNameFor(model => model.Approval)
</th>
<th>
@Html.ActionLink("Jan", "Index", new { sortOrder = ViewBag.JanSortParm })
@*@Html.DisplayNameFor(model => model.Jan)*@
</th>
<th>
@Html.ActionLink("Feb", "Index", new { sortOrder = ViewBag.FebSortParm })
@*@Html.DisplayNameFor(model => model.Feb)*@
</th>
<th>
@Html.ActionLink("Mar", "Index", new { sortOrder = ViewBag.MarSortParm })
@*@Html.DisplayNameFor(model => model.Mar)*@
</th>
<th>
@Html.ActionLink("Apr", "Index", new { sortOrder = ViewBag.AprSortParm })
@*@Html.DisplayNameFor(model => model.Apr)*@
</th>
<th>
@Html.ActionLink("May", "Index", new { sortOrder = ViewBag.MaySortParm })
@*@Html.DisplayNameFor(model => model.May)*@
</th>
<th>
@Html.ActionLink("Jun", "Index", new { sortOrder = ViewBag.JunSortParm })
@*@Html.DisplayNameFor(model => model.Jun)*@
</th>
<th>
@Html.ActionLink("Jul", "Index", new { sortOrder = ViewBag.JulSortParm })
@*@Html.DisplayNameFor(model => model.Jul)*@
</th>
<th>
@Html.ActionLink("Aug", "Index", new { sortOrder = ViewBag.AugSortParm })
@*@Html.DisplayNameFor(model => model.Aug)*@
</th>
<th>
@Html.ActionLink("Sep", "Index", new { sortOrder = ViewBag.SepSortParm })
@*@Html.DisplayNameFor(model => model.Sep)*@
</th>
<th>
@Html.ActionLink("Oct", "Index", new { sortOrder = ViewBag.OctSortParm })
@*@Html.DisplayNameFor(model => model.Oct)*@
</th>
<th>
@Html.ActionLink("Nov", "Index", new { sortOrder = ViewBag.NovSortParm })
@*@Html.DisplayNameFor(model => model.Nov)*@
</th>
<th>
@Html.ActionLink("Dec", "Index", new { sortOrder = ViewBag.DecSortParm })
@*@Html.DisplayNameFor(model => model.Dec)*@
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Employer)
</td>
<td>
@Html.DisplayFor(modelItem => item.ITONumber)
</td>
<td>
@Html.DisplayFor(modelItem => item.Description)
</td>
<td>
@Html.DisplayFor(modelItem => item.TECNumber)
</td>
<td>
@Html.DisplayFor(modelItem => item.TECVersion)
</td>
<td>
@Html.DisplayFor(modelItem => item.Level)
</td>
<td>
@Html.DisplayFor(modelItem => item.Credits)
</td>
<td>
@Html.DisplayFor(modelItem => item.Duration)
</td>
<td>
@Html.DisplayFor(modelItem => item.Sector)
</td>
<td>
@Html.DisplayFor(modelItem => item.Status)
</td>
<td>
@Html.DisplayFor(modelItem => item.Approval)
</td>
<td>
@Html.DisplayFor(modelItem => item.Jan)
</td>
<td>
@Html.DisplayFor(modelItem => item.Feb)
</td>
<td>
@Html.DisplayFor(modelItem => item.Mar)
</td>
<td>
@Html.DisplayFor(modelItem => item.Apr)
</td>
<td>
@Html.DisplayFor(modelItem => item.May)
</td>
<td>
@Html.DisplayFor(modelItem => item.Jun)
</td>
<td>
@Html.DisplayFor(modelItem => item.Jul)
</td>
<td>
@Html.DisplayFor(modelItem => item.Aug)
</td>
<td>
@Html.DisplayFor(modelItem => item.Sep)
</td>
<td>
@Html.DisplayFor(modelItem => item.Oct)
</td>
<td>
@Html.DisplayFor(modelItem => item.Nov)
</td>
<td>
@Html.DisplayFor(modelItem => item.Dec)
</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>
@model IEnumerable
@{
ViewBag.Title=“Index”;
}
指数
@使用(Html.BeginForm())
{
部门
@Html.DropDownList(“扇区”,新选择列表(ViewBag.sector))
}
@ActionLink(“新建”、“创建”)
@ActionLink(“雇主”、“索引”,新的{sortOrder=ViewBag.employeersortparm})
@*@Html.DisplayNameFor(model=>model.Employer)*@
@ActionLink(“ITONumber”,“Index”,new{sortOrder=ViewBag.ITOSortParm})
@*@DisplayNameFor(model=>model.ITONumber)*@
@DisplayNameFor(model=>model.Description)
@DisplayNameFor(model=>model.TECNumber)
@DisplayNameFor(model=>model.TECVersion)
@DisplayNameFor(model=>model.Level)
@DisplayNameFor(model=>model.Credits)
@DisplayNameFor(model=>model.Duration)
@ActionLink(“扇区”、“索引”,新的{sortOrder=ViewBag.SectorSortParm})
@*@DisplayNameFor(model=>model.Sector)*@
@DisplayNameFor(model=>model.Status)
@Html.DisplayNameFor(model=>model.Approval)
@ActionLink(“Jan”,“Index”,new{sortOrder=ViewBag.JanSortParm})
@*@DisplayNameFor(model=>model.Jan)*@
@ActionLink(“Feb”,“Index”,new{sortOrder=ViewBag.FebSortParm})
@*@DisplayNameFor(model=>model.Feb)*@
@ActionLink(“Mar”,“Index”,new{sortOrder=ViewBag.MarSortParm})
@*@DisplayNameFor(model=>model.Mar)*@
@ActionLink(“Apr”,“Index”,new{sortOrder=ViewBag.AprSortParm})
@*@DisplayNameFor(model=>model.Apr)*@
@ActionLink(“May”,“Index”,new{sortOrder=ViewBag.MaySortParm})
@*@DisplayNameFor(model=>model.May)*@
@ActionLink(“Jun”,“Index”,new{sortOrder=ViewBag.JunSortParm})
@*@DisplayNameFor(model=>model.Jun)*@
@ActionLink(“Jul”,“Index”,new{sortOrder=ViewBag.JulSortParm})
@*@DisplayNameFor(model=>model.Jul)*@
@ActionLink(“Aug”,“Index”,new{sortOrder=ViewBag.AugSortParm})
@*@DisplayNameFor(model=>model.Aug)*@
@ActionLink(“Sep”,“Index”,new{sortOrder=ViewBag.SepSortParm})
@*@DisplayNameFor(model=>model.Sep)*@
@ActionLink(“Oct”,“Index”,new{sortOrder=ViewBag.OctSortParm})
@*@DisplayNameFor(model=>model.Oct)*@
@ActionLink(“Nov”,“Index”,new{sortOrder=ViewBag.NovSortParm})
@*@DisplayNameFor(model=>model.Nov)*@
@ActionLink(“Dec”,“Index”,new{sortOrder=ViewBag.DecSortParm})
@*@DisplayNameFor(model=>model.Dec)*@
@foreach(模型中的var项目){
@DisplayFor(modelItem=>item.Employer)
@DisplayFor(modelItem=>item.ITONumber)
@DisplayFor(modelItem=>item.Description)
@DisplayFor(modelItem=>item.TECNumber)
@DisplayFor(modelItem=>item.TECVersion)
@DisplayFor(modelItem=>item.Level)
@DisplayFor(modelItem=>item.Credits)
@DisplayFor(modelItem=>item.Duration)
@DisplayFor(modelItem=>item.Sector)
@DisplayFor(modelItem=>item.Status)
@DisplayFor(modelItem=>item.Approval)
@DisplayFor(modeleItem=>item.Jan)
@DisplayFor(modelItem=>item.Feb)
@DisplayFor(modeleItem=>item.Mar)
@DisplayFor(modeleItem=>item.Apr)
@DisplayFor(modeleItem=>item.May)
@DisplayFor(modeleItem=>item.Jun)
@DisplayFor(modeleItem=>item.Jul)
@DisplayFor(modeleItem=>item.Aug)
@DisplayFor(modeleItem=>item.Sep)
@DisplayFor(modeleItem=>item.Oct)