I want to be able to select a few boxes and send the strings correlating to them. The problem however is that I don't know how to catch the values in the controller.
One important issue is that I do not want to bind it to a model! Hopefully you can help me find a solution that fits in this image
cshtml file:
@model IEnumerable<WebApplication1.Models.WikiPage>
@using (Html.BeginForm("DeletePages", "Home", FormMethod.Post))
{
<ul>
@foreach (var item in @Model)
{
<li>
@Html.CheckBox(item.Title)
@Html.Label(item.Title)
</li>
}
</ul>
<input type="submit" value="Delete pages" />
}
And here is the part in the controller. String... will be null and I don't know what I should put in there to catch the values
[HttpPost]
public ActionResult DeletePages(String... Titles)
{
removePages(Titles);
List<WikiPage> pages = db.WikiPages.ToList();
return View(pages);
}
Hope you can help me!
Kind regards
Aucun commentaire:
Enregistrer un commentaire