Hi all, I'm trying to keep the values of checkboxes in a form with the same name (level and coursetype) in the querystring so I can check which ones were selected. In the first submit, I get:
Search?coursetype=1416&coursetype=post16&level=3&level=6&level=1
which is fine so I can check the values back into the view and tick the ones previously selected.
However, when I use a pagedList or Html.ActionLink, for example:
Html.ActionLink("search again", "Search", new { coursetype = ViewData["coursetype"], level = ViewData["level"]})
I get: Search?&coursetype=System.String%5B%5D&level=System.String%5B%5D
I tried parsing those values from the array but then when I send them to htmlAttributes in the ActionLink I get: Search?coursetype%3D1416&coursetype%3Dpost16&level%3D3&level%3D6&level%3D1
so the view can't find the values of the checkbox.
Controller:
[AcceptVerbs("GET")]
public ActionResult Search(string[] coursetype, string[] level)
{
ViewData["level"] = level;
ViewData["coursetype"] = coursetype;
return View();
}