This is a continuation of multiple checkbox logic with search function
I have the multiple checkboxes setup and the search function working. However, when I navigate to the next page I lose the original data that was found ie: I search for 001 and select the Resolutions Number checkbox; it produces 3 pages of results, but when I click on Page 2 it returns 40 pages of results
I know the issue is the checkbox(es) losing their value but I do not know how to maintain the value of the checkbox after post. Do I maintain the checkbox in the Controller, some JavaScript, the Model, or the View?
In my View I am currently creating the checkboxes:
<div style="float:right"><strong>Year: </strong>@Html.CheckBox("ResYear") <strong>Resolution Number:</strong> @Html.CheckBox("ResNumber") <strong>Keyword:</strong> @Html.CheckBox("Keyword")
and in the Controller Index method I am passing the values as: public ViewResult Index(string sortOrder, string currentFilter, string searchString, int? page, IEnumerable<bool> ResYear, IEnumerable<bool> ResNumber, IEnumerable<bool> Keyword)
When I post, the values of ResYear, ResNumber, and Keyword
are lost and therefore never meet the if statement criteria
Aucun commentaire:
Enregistrer un commentaire