我对pagedlist有疑问。 我有一个数据网格,可以使用dropdownlist和checkbox进行过滤。我使用“ PagedList”,它在我的数据网格中每页仅显示10行。不使用过滤器时效果很好。例如,当我在下拉列表中选择一个项目时,该过滤器在第一页上运行良好,但是如果我在第二页上单击,则该过滤器不再起作用。为了过滤数据,我使用Post和ViewModel方法,该怎么办? 谢谢! 这是我的观点:
@using (Html.BeginForm("Index", "Missions", FormMethod.Post))
{
<section>
<h3>Localisation</h3>
@*
<div class="form-group">
@Html.LabelFor(model => model.DirGeoSelected, "Direction geo", htmlAttributes: new { @class = "control-label col-md-8" })
<div class="col-md-4">
@Html.DropDownListFor(model => model.DirGeoSelected, Model.DirGeoList, htmlAttributes: new { onchange = "form.submit();", @class = "form-control" })
@Html.ValidationMessageFor(model => model.DirGeoSelected, "", new { @class = "text-danger" })
</div>
</div>
*@
<div class="form-group">
@Html.LabelFor(model => model.ProgrammeIdSelected, "Programme", htmlAttributes: new { @class = "control-label col-md-5" })
<div class="col-md-7">
@Html.DropDownListFor(model => model.ProgrammeIdSelected, Model.Programme, "All", htmlAttributes: new { onchange = "form.submit();", @class = "form-control" })
@Html.ValidationMessageFor(model => model.ProgrammeIdSelected, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.CountryIdSelected, "Pays", htmlAttributes: new { @class = "control-label col-md-5" })
<div class="col-md-7">
@Html.DropDownListFor(model => model.CountryIdSelected, Model.Country, "All", htmlAttributes: new { onchange = "form.submit();", @class = "form-control"/*, data_url = Url.Action("GetCountries")*/ })
@Html.ValidationMessageFor(model => model.CountryIdSelected, "", new { @class = "text-danger" })
</div>
</div>
</section>
<section>
<h3>Personne</h3>
</section>
<section>
@*
<h3>Date</h3>
<div class="form-group">
<div class="col-md-8">
@Html.TextBox("SelectedDateStart", new {@class = "datepicker"})
</div>
</div>
<div class="form-group">
<div class="col-md-8">
@Html.TextBox("SelectedDateEnd", new { @class = "datepicker"})
</div>
</div>
*@
</section>
<section>
<h3>Type</h3>
<div class="col-md-12 form-check">
@Html.CheckBox("Support", true, new { onchange = "form.submit();", @class = "form-check-input" })
@Html.Label("Mission Support", htmlAttributes: new { @class = "control-label" })
@Html.CheckBox("Autre", true, new { onchange = "form.submit();", @class = "form-check-input" })
@Html.Label("Autre", htmlAttributes: new { @class = "control-label" })
</div>
</section>
<section>
<h3>Priority</h3>
<div class="col-md-12 form-check">
@Html.CheckBox("Support", true, new { onchange = "form.submit();", @class = "form-check-input" })
@Html.Label("Mission Support", htmlAttributes: new { @class = "control-label" })
@Html.CheckBox("Autre", true, new { onchange = "form.submit();", @class = "form-check-input" })
@Html.Label("Autre", htmlAttributes: new { @class = "control-label" })
</div>
</section>
<section>
<h3>Décision</h3>
<div class="col-md-12">
@Html.EditorFor(x => x.Decison)
</div>
</section>
<section>
<h3>Equipe</h3>
@*
<div class="form-group">
@Html.LabelFor(model => model.DirectionIdSelected, "Direction", htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-8">
@Html.DropDownListFor(model => model.DirectionIdSelected, Model.DirectionList, htmlAttributes: new { onchange = "form.submit();", @class = "form-control" })
@Html.ValidationMessageFor(model => model.DirectionIdSelected, "", new { @class = "text-danger" })
</div>
</div>
*@
</section>
}
</nav>
<div id="content" class="container">
<h2>Missions</h2>
@* @using (Html.BeginForm("Index", "Missions", FormMethod.Get))
{
@Html.TextBox("searching")
<input type="submit" value="submit" />
}
*@
<p class="newmission">
<input type="button" class="btn btn-info" value="Nouvelle Mission" onclick="location.href='@Url.Action("Create", "Missions")'" />
</p>
<table class="table table-bordered">
<tr>
<th class="col-md-2">
@Html.ActionLink("Pays", "Index",
new { SortOrder = Model.SortCountry})
</th>
<th class="col-md-1">
@Html.ActionLink("Date", "Index",
new { SortOrder = ViewBag.ListorderDate,
/*SelectedDesk = ViewBag.ListorderPays,
SelectedProgramme = ViewBag.ListorderDate,*/
})
</th>
<th class="col-md-2">
Personne
</th>
<th class="col-md-10">
Missions
</th>
<th class="col-md-10">
</th>
</tr>
@foreach (var item in Model.OnePageOfMissions)
{
<tr>
<td class="col-md-1">
@Html.DisplayFor(modelItem => item.decision)
</td>
<td class="col-md-2">
@Html.DisplayFor(modelItem => item.organization_hi_country.name_en)
</td>
<td class="col-md-1">
@Html.DisplayFor(modelItem => item.asked_date)
</td>
<td class="col-md-2"></td>
<td class="col-md-10">
<span class="typemission">Mission</span> @Html.DisplayFor(modelItem => item.list_type.name_en, new { @class = "typemission" }) : @Html.DisplayFor(modelItem => item.list_nature.name_en, new { @class = "typemission" })
<div>
<!-- les boutons d'actions -->
<a href="#@Html.DisplayFor(modelItem => item.id)" data-toggle="collapse" aria-expanded="false" aria-controls="@Html.DisplayFor(modelItem => item.id)">details</a>
</div>
<!-- le contenu masqué -->
<section id="@Html.DisplayFor(modelItem => item.id)" class="collapse">
<div class="well">
<p><em>Statut: </em>@Html.DisplayFor(modelItem => item.list_statut.name_en)</p>
<p><em>Durée: </em>@Html.DisplayFor(modelItem => item.duration) jours</p>
<p><em>Flexibilité: </em>@Html.DisplayFor(modelItem => item.list_flexibility.name_en) </p>
<p><em>Priorité: </em>@Html.DisplayFor(modelItem => item.list_priority.name_en) </p>
<p><em>Commentaires: </em>@Html.DisplayFor(modelItem => item.comments) </p>
</div>
</section>
</td>
<td class="col-md-10">
@Html.ActionLink("Edit", "Create", new { id = item.id })
@Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
</td>
</tr>
}
@Html.PagedListPager((IPagedList)Model.OnePageOfMissions, page => Url.Action("Index", new { searchItem = ViewBag.searchItem, page }))
</table>
这是我的控制人:
namespace MissionsDF.Controllers
{ 公共类MissionsController:控制器 { 私人Missions_devEntities db =新的Missions_devEntities();
// GET: /Missions/
public ActionResult Index(string SortOrder, int? page)
{
IndexViewModel model = new IndexViewModel();
//Affichage de la liste des Programmes
model.Programme = GetProgrammes();
//Tri des pays:
model.SortCountry = String.IsNullOrEmpty(SortOrder) ? "ListorderPays_desc" : "";
model.missionsList = db.missions_supportmission.ToList();
switch (SortOrder)
{
case "ListorderPays_desc":
model.missionsList = model.missionsList.OrderByDescending(s => s.organization_hi_country.name_en);
break;
default:
model.missionsList = model.missionsList.OrderBy(s => s.organization_hi_country.name_en);
break;
}
//Pagination
var pageNumber = page ?? 1; // if no page was specified in the querystring, default to the first page (1)
var onePageOfMissions = model.missionsList.ToPagedList(pageNumber, 10); // will only contain 10 products max because of the pageSize(equel to 10)
model.OnePageOfMissions = onePageOfMissions;
//Ischecked
var allDecisions = db.list_decision.ToList();//returns List<list_decision>
var checkBoxListItems = new List<CheckBoxListItem>(); //nouvelle instance de la classe checkboxlist
foreach (var decison in allDecisions)
{//On assigne les valeurs "id", "display" et "is checked" à la variable checkboxlistitem
checkBoxListItems.Add(new CheckBoxListItem()
{
ID = decison.decision_id,
Display = decison.name_en,
IsChecked = false //On the add view, no decision are selected by default
});
}
model.Decison = checkBoxListItems;
return View(model);
}
private List<SelectListItem> GetProgrammes()
{
return db.organization_programme
.Select(x => new SelectListItem
{
Value = x.prog_id,
Text = x.name_en
})
.ToList();
}
//POST: /Missions/Index
[HttpPost]
public ActionResult Index(IndexViewModel model, int? page)
{
//Filtres sur Programme et Country
if (ModelState.IsValid)
{
var pageNumber = page ?? 1;
var selecteddecision = model.Decison.Where(x => x.IsChecked).Select(x => x.ID);
//Si selecteddecision n'est pas null
//Si Programme n'est pas null et que country est null
if (!(selecteddecision.IsAny()))
{
if (!String.IsNullOrEmpty(model.ProgrammeIdSelected) && String.IsNullOrEmpty(model.CountryIdSelected))
{
var onePageOfMissions = db.missions_supportmission
.Where(a => a.programme_id == model.ProgrammeIdSelected)
.OrderBy(a => a.programme_id)
.Select(s => s).ToPagedList(pageNumber, 10);
model.OnePageOfMissions = onePageOfMissions;
}
//Si Country est null
else if (!String.IsNullOrEmpty(model.CountryIdSelected))
{
model.OnePageOfMissions = db.missions_supportmission
.Where(a => a.country_id == model.CountryIdSelected)
.OrderBy(a => a.country_id)
.Select(s => s).ToPagedList(pageNumber, 10);
if (model.missionsList != null)
{
var onePageOfMissions = model.missionsList.ToPagedList(pageNumber, 10);
model.OnePageOfMissions = onePageOfMissions;
}
}
//Sinon on affiche tout
else
{
model.OnePageOfMissions = db.missions_supportmission
.OrderBy(a => a.programme_id)
.Select(s => s).ToPagedList(pageNumber, 10);
}
}
else
{
foreach (var item in selecteddecision)
{
//Si Programme n'est pas null et que country est null
if (!String.IsNullOrEmpty(model.ProgrammeIdSelected) && String.IsNullOrEmpty(model.CountryIdSelected))
{
model.OnePageOfMissions = db.missions_supportmission
.Where(a => a.programme_id == model.ProgrammeIdSelected)
.Where(a => a.decision == item)
.OrderBy(a => a.programme_id)
.Select(s => s).ToPagedList(pageNumber, 10);
var onePageOfMissions = model.missionsList.ToPagedList(pageNumber, 10);
model.OnePageOfMissions = onePageOfMissions;
}
//Si Country est null
else if (!String.IsNullOrEmpty(model.CountryIdSelected))
{
model.OnePageOfMissions = db.missions_supportmission
.Where(a => a.country_id == model.CountryIdSelected)
.Where(a => a.decision == item)
.OrderBy(a => a.country_id)
.Select(s => s).ToPagedList(pageNumber, 10);
var onePageOfMissions = model.missionsList.ToPagedList(pageNumber, 10);
model.OnePageOfMissions = onePageOfMissions;
}
//Sinon on affiche tout
else
{
model.OnePageOfMissions = db.missions_supportmission
.Where(a => a.decision == item)
.OrderBy(a => a.programme_id)
.Select(s => s).ToPagedList(pageNumber, 10);
}
}
}
}
var allDecisions = db.list_decision.ToList();//returns List<list_decision>
var checkBoxListItems = new List<CheckBoxListItem>(); //nouvelle instance de la classe checkboxlist
foreach (var decison in allDecisions)
{//On assigne les valeurs "id", "display" et "is checked" à la variable checkboxlistitem
checkBoxListItems.Add(new CheckBoxListItem()
{
ID = decison.decision_id,
Display = decison.name_en,
});
}
model.Decison = checkBoxListItems;
//Affichage en cascade liste de programmes + liste pays
model.Programme = GetProgrammes();
model.Country = db.organization_hi_country
.Where(a => a.prog_id == model.ProgrammeIdSelected)
.Select(x => new SelectListItem
{
Value = x.country_id,
Text = x.name_en
}).ToList();
return View(model);
}
答案 0 :(得分:0)
1)如果您愿意同时修改和修改服务器端和客户端的代码,建议按照this tutorial
所述的说明进行操作2)如果您想使用Post方法,那么以下更改可能会为您提供帮助:
在服务器端代码中,无论将对象分配给'ViewBag.searchItem'的位置如何,都尝试使用TempData [“ searchItem”]代替它。并且在“视图”页面上访问它时,无论您要通过适当的投射访问“ ViewBag.searchItem”,还是在任何地方都使用TempData [“ searchItem”]。
虽然我想您的服务器端代码可以正常工作,但是客户端html可以按如下所示工作,并且表单标签包裹在整个HTML上。
@using (Html.BeginForm("Index", "Missions", FormMethod.Post))
{
<section>
<h3>Localisation</h3>
@*
<div class="form-group">
@Html.LabelFor(model => model.DirGeoSelected, "Direction geo", htmlAttributes: new { @class = "control-label col-md-8" })
<div class="col-md-4">
@Html.DropDownListFor(model => model.DirGeoSelected, Model.DirGeoList, htmlAttributes: new { onchange = "form.submit();", @class = "form-control" })
@Html.ValidationMessageFor(model => model.DirGeoSelected, "", new { @class = "text-danger" })
</div>
</div>
*@
<div class="form-group">
@Html.LabelFor(model => model.ProgrammeIdSelected, "Programme", htmlAttributes: new { @class = "control-label col-md-5" })
<div class="col-md-7">
@Html.DropDownListFor(model => model.ProgrammeIdSelected, Model.Programme, "All", htmlAttributes: new { onchange = "form.submit();", @class = "form-control" })
@Html.ValidationMessageFor(model => model.ProgrammeIdSelected, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.CountryIdSelected, "Pays", htmlAttributes: new { @class = "control-label col-md-5" })
<div class="col-md-7">
@Html.DropDownListFor(model => model.CountryIdSelected, Model.Country, "All", htmlAttributes: new { onchange = "form.submit();", @class = "form-control"/*, data_url = Url.Action("GetCountries")*/ })
@Html.ValidationMessageFor(model => model.CountryIdSelected, "", new { @class = "text-danger" })
</div>
</div>
</section>
<section>
<h3>Personne</h3>
</section>
<section>
@*
<h3>Date</h3>
<div class="form-group">
<div class="col-md-8">
@Html.TextBox("SelectedDateStart", new {@class = "datepicker"})
</div>
</div>
<div class="form-group">
<div class="col-md-8">
@Html.TextBox("SelectedDateEnd", new { @class = "datepicker"})
</div>
</div>
*@
</section>
<section>
<h3>Type</h3>
<div class="col-md-12 form-check">
@Html.CheckBox("Support", true, new { onchange = "form.submit();", @class = "form-check-input" })
@Html.Label("Mission Support", htmlAttributes: new { @class = "control-label" })
@Html.CheckBox("Autre", true, new { onchange = "form.submit();", @class = "form-check-input" })
@Html.Label("Autre", htmlAttributes: new { @class = "control-label" })
</div>
</section>
<section>
<h3>Priority</h3>
<div class="col-md-12 form-check">
@Html.CheckBox("Support", true, new { onchange = "form.submit();", @class = "form-check-input" })
@Html.Label("Mission Support", htmlAttributes: new { @class = "control-label" })
@Html.CheckBox("Autre", true, new { onchange = "form.submit();", @class = "form-check-input" })
@Html.Label("Autre", htmlAttributes: new { @class = "control-label" })
</div>
</section>
<section>
<h3>Décision</h3>
<div class="col-md-12">
@Html.EditorFor(x => x.Decison)
</div>
</section>
<section>
<h3>Equipe</h3>
@*
<div class="form-group">
@Html.LabelFor(model => model.DirectionIdSelected, "Direction", htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-8">
@Html.DropDownListFor(model => model.DirectionIdSelected, Model.DirectionList, htmlAttributes: new { onchange = "form.submit();", @class = "form-control" })
@Html.ValidationMessageFor(model => model.DirectionIdSelected, "", new { @class = "text-danger" })
</div>
</div>
*@
</section> <div id="content" class="container">
<h2>Missions</h2>
<p class="newmission">
<input type="button" class="btn btn-info" value="Nouvelle Mission" onclick="location.href='@Url.Action("Create", "Missions")'" />
</p>
<table class="table table-bordered">
<tr>
<th class="col-md-2">
@Html.ActionLink("Pays", "Index",
new { SortOrder = Model.SortCountry})
</th>
<th class="col-md-1">
@Html.ActionLink("Date", "Index",
new { SortOrder = ViewBag.ListorderDate,
/*SelectedDesk = ViewBag.ListorderPays,
SelectedProgramme = ViewBag.ListorderDate,*/
})
</th>
<th class="col-md-2">
Personne
</th>
<th class="col-md-10">
Missions
</th>
<th class="col-md-10">
</th>
</tr>
@foreach (var item in Model.OnePageOfMissions)
{
<tr>
<td class="col-md-1">
@Html.DisplayFor(modelItem => item.decision)
</td>
<td class="col-md-2">
@Html.DisplayFor(modelItem => item.organization_hi_country.name_en)
</td>
<td class="col-md-1">
@Html.DisplayFor(modelItem => item.asked_date)
</td>
<td class="col-md-2"></td>
<td class="col-md-10">
<span class="typemission">Mission</span> @Html.DisplayFor(modelItem => item.list_type.name_en, new { @class = "typemission" }) : @Html.DisplayFor(modelItem => item.list_nature.name_en, new { @class = "typemission" })
<div>
<!-- les boutons d'actions -->
<a href="#@Html.DisplayFor(modelItem => item.id)" data-toggle="collapse" aria-expanded="false" aria-controls="@Html.DisplayFor(modelItem => item.id)">details</a>
</div>
<!-- le contenu masqué -->
<section id="@Html.DisplayFor(modelItem => item.id)" class="collapse">
<div class="well">
<p><em>Statut: </em>@Html.DisplayFor(modelItem => item.list_statut.name_en)</p>
<p><em>Durée: </em>@Html.DisplayFor(modelItem => item.duration) jours</p>
<p><em>Flexibilité: </em>@Html.DisplayFor(modelItem => item.list_flexibility.name_en) </p>
<p><em>Priorité: </em>@Html.DisplayFor(modelItem => item.list_priority.name_en) </p>
<p><em>Commentaires: </em>@Html.DisplayFor(modelItem => item.comments) </p>
</div>
</section>
</td>
<td class="col-md-10">
@Html.ActionLink("Edit", "Create", new { id = item.id })
@Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
</td>
</tr>
}
@Html.PagedListPager((IPagedList)Model.OnePageOfMissions, page => Url.Action("Index", new { page }))
</table>}
答案 1 :(得分:0)
谢谢,我找到了解决方案。我决定只使用get方法。
在我的控制器中,我有这个:
public ActionResult Index(string SortOrder, int? page, string ProgrammeIdSelected)
{
IndexViewModel model = new IndexViewModel();
//Affichage de la liste des Programmes
model.Programme = GetProgrammes();
//Tri des pays:
model.SortCountry = String.IsNullOrEmpty(SortOrder) ? "ListorderPays_desc" : "";
model.ProgrammeIdSelected = ProgrammeIdSelected;
model.missionsList = db.missions_supportmission.ToList();
switch (SortOrder)
{
case "ListorderPays_desc":
model.missionsList = model.missionsList.OrderByDescending(s => s.organization_hi_country.name_en);
break;
default:
model.missionsList = model.missionsList.OrderBy(s => s.organization_hi_country.name_en);
break;
}
//Pagination
var pageNumber = page ?? 1; // if no page was specified in the querystring, default to the first page (1)
var onePageOfMissions = model.missionsList.ToPagedList(pageNumber, 10); // will only contain 10 products max because of the pageSize(equel to 10)
model.OnePageOfMissions = onePageOfMissions;
//Ischecked
var allDecisions = db.list_decision.ToList();//returns List<list_decision>
var checkBoxListItems = new List<CheckBoxListItem>(); //nouvelle instance de la classe checkboxlist
foreach (var decison in allDecisions)
{//On assigne les valeurs "id", "display" et "is checked" à la variable checkboxlistitem
checkBoxListItems.Add(new CheckBoxListItem()
{
ID = decison.decision_id,
Display = decison.name_en,
IsChecked = false //On the add view, no decision are selected by default
});
}
//Si Programme n'est pas null et que country est null
if (!String.IsNullOrEmpty(ProgrammeIdSelected))
{
model.OnePageOfMissions = db.missions_supportmission
.Where(a => a.programme_id == ProgrammeIdSelected)
.OrderBy(a => a.programme_id)
.Select(s => s).ToPagedList(pageNumber, 10);
}
return View(model);
}
在我的视野中,我有这个:
@using (Html.BeginForm("Index", "Missions", FormMethod.Get))
{
<section>
<h3>Localisation</h3>
@*
<div class="form-group">
@Html.LabelFor(model => model.DirGeoSelected, "Direction geo", htmlAttributes: new { @class = "control-label col-md-8" })
<div class="col-md-4">
@Html.DropDownListFor(model => model.DirGeoSelected, Model.DirGeoList, htmlAttributes: new { onchange = "form.submit();", @class = "form-control" })
@Html.ValidationMessageFor(model => model.DirGeoSelected, "", new { @class = "text-danger" })
</div>
</div>
*@
<div class="form-group">
@Html.LabelFor(model => model.ProgrammeIdSelected, "Programme", htmlAttributes: new { @class = "control-label col-md-5" })
<div class="col-md-7">
@Html.DropDownListFor(model => model.ProgrammeIdSelected, Model.Programme, "All", htmlAttributes: new {onchange = "form.submit();", @class = "form-control"})
@Html.ValidationMessageFor(model => model.ProgrammeIdSelected, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.CountryIdSelected, "Pays", htmlAttributes: new { @class = "control-label col-md-5" })
<div class="col-md-7">
@Html.DropDownListFor(model => model.CountryIdSelected, Model.Country, "All", htmlAttributes: new { onchange = "form.submit();", @class = "form-control"/*, data_url = Url.Action("GetCountries")*/ })
@Html.ValidationMessageFor(model => model.CountryIdSelected, "", new { @class = "text-danger" })
</div>
</div>
</section>
<section>
<h3>Personne</h3>
</section>
<section>
@*
<h3>Date</h3>
<div class="form-group">
<div class="col-md-8">
@Html.TextBox("SelectedDateStart", new {@class = "datepicker"})
</div>
</div>
<div class="form-group">
<div class="col-md-8">
@Html.TextBox("SelectedDateEnd", new { @class = "datepicker"})
</div>
</div>
*@
</section>
<section>
<h3>Type</h3>
<div class="col-md-12 form-check">
@Html.CheckBox("Support", true, new { onchange = "form.submit();", @class = "form-check-input" })
@Html.Label("Mission Support", htmlAttributes: new { @class = "control-label" })
@Html.CheckBox("Autre", true, new { onchange = "form.submit();", @class = "form-check-input" })
@Html.Label("Autre", htmlAttributes: new { @class = "control-label" })
</div>
</section>
<section>
<h3>Priority</h3>
<div class="col-md-12 form-check">
@Html.CheckBox("Support", true, new { onchange = "form.submit();", @class = "form-check-input" })
@Html.Label("Mission Support", htmlAttributes: new { @class = "control-label" })
@Html.CheckBox("Autre", true, new { onchange = "form.submit();", @class = "form-check-input" })
@Html.Label("Autre", htmlAttributes: new { @class = "control-label" })
</div>
</section>
<section>
<h3>Décision</h3>
<div class="col-md-12">
@Html.EditorFor(x => x.Decison)
</div>
</section>
<section>
<h3>Equipe</h3>
@*
<div class="form-group">
@Html.LabelFor(model => model.DirectionIdSelected, "Direction", htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-8">
@Html.DropDownListFor(model => model.DirectionIdSelected, Model.DirectionList, htmlAttributes: new { onchange = "form.submit();", @class = "form-control" })
@Html.ValidationMessageFor(model => model.DirectionIdSelected, "", new { @class = "text-danger" })
</div>
</div>
*@
</section>
}
</nav>
<div id="content" class="container">
<h2>Missions</h2>
@* @using (Html.BeginForm("Index", "Missions", FormMethod.Get))
{
@Html.TextBox("searching")
<input type="submit" value="submit" />
}
*@
<p class="newmission">
<input type="button" class="btn btn-info" value="Nouvelle Mission" onclick="location.href='@Url.Action("Create", "Missions")'" />
</p>
<table class="table table-bordered">
<tr>
<th class="col-md-2">
@Html.ActionLink("Pays", "Index",
new { SortOrder = Model.SortCountry})
</th>
<th class="col-md-1">
@Html.ActionLink("Date", "Index",
new { SortOrder = ViewBag.ListorderDate,
/*SelectedDesk = ViewBag.ListorderPays,
SelectedProgramme = ViewBag.ListorderDate,*/
})
</th>
<th class="col-md-2">
Personne
</th>
<th class="col-md-10">
Missions
</th>
<th class="col-md-10">
</th>
</tr>
@foreach (var item in Model.OnePageOfMissions)
{
<tr>
<td class="col-md-1">
@Html.DisplayFor(modelItem => item.decision)
</td>
<td class="col-md-2">
@Html.DisplayFor(modelItem => item.organization_hi_country.name_en)
</td>
<td class="col-md-1">
@Html.DisplayFor(modelItem => item.asked_date)
</td>
<td class="col-md-2"></td>
<td class="col-md-10">
<span class="typemission">Mission</span> @Html.DisplayFor(modelItem => item.list_type.name_en, new { @class = "typemission" }) : @Html.DisplayFor(modelItem => item.list_nature.name_en, new { @class = "typemission" })
<div>
<!-- les boutons d'actions -->
<a href="#@Html.DisplayFor(modelItem => item.id)" data-toggle="collapse" aria-expanded="false" aria-controls="@Html.DisplayFor(modelItem => item.id)">details</a>
</div>
<!-- le contenu masqué -->
<section id="@Html.DisplayFor(modelItem => item.id)" class="collapse">
<div class="well">
<p><em>Statut: </em>@Html.DisplayFor(modelItem => item.list_statut.name_en)</p>
<p><em>Durée: </em>@Html.DisplayFor(modelItem => item.duration) jours</p>
<p><em>Flexibilité: </em>@Html.DisplayFor(modelItem => item.list_flexibility.name_en) </p>
<p><em>Priorité: </em>@Html.DisplayFor(modelItem => item.list_priority.name_en) </p>
<p><em>Commentaires: </em>@Html.DisplayFor(modelItem => item.comments) </p>
</div>
</section>
</td>
<td class="col-md-10">
@Html.ActionLink("Edit", "Create", new { id = item.id })
@Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
</td>
</tr>
}
@Html.PagedListPager((IPagedList)Model.OnePageOfMissions, page => Url.Action("Index", new { page, ProgrammeIdSelected = Model.ProgrammeIdSelected }))
</table>