Reputation: 35
I have a question about PagedList. I have a grid of data that I can filter using dropdownlist and checkbox. It works well. I use "PagedList", which allows me to display only 10 row per page in my grid of data. It works well when I don't use filter. When I select an item in my dropdownlist for example, the filter works well in the first page but if I click on the 2nd page the filter doesn't work anymore. To filter data, I use method Post and ViewModel. What can I do? Thanks! Here is my view:
@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>
Here is my controller:
namespace MissionsDF.Controllers
{ public class MissionsController : Controller { private Missions_devEntities db = new 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);
}
Upvotes: 0
Views: 3287
Reputation: 35
Thanks, I found the solution. I decided to use only get method.
In my controller I have this:
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);
}
An d in my View I have this:
@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>
Upvotes: 0
Reputation: 360
1) If you are willing to revamp and modify your code both server side and client-side, I recommend following instructions mentioned at this tutorial
2) In case you want to use Post method then, following changes may help you:
In your server side code, wherever you are assigning an object to 'ViewBag.searchItem', try using TempData["searchItem"] in place of it. And when accessing it on View page, also use TempData["searchItem"] wherever you are accessing 'ViewBag.searchItem' with appropriate casting.
While I suppose your server side code is working, client side html may work as shown below, with form tag wrapped around entire 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>}
Upvotes: 0