case is , First I checked few check box and than submit it , even after clicking on submit the checkbox should be checked as previously selected. Please help me in achieving it. For example have a look at Custom filter in stack overflow this is my HTML code:
<form asp-controller="Student" asp-action="FilterStu">
<div class="dropdown">
<div class="selectBox" onclick="showCheckboxes()">
<select class="btn btn-outline-secondary">
<option style="color:darkturquoise">
Filter
</option>
</select>
<div class="overSelect"></div>
</div>
<div id="checkboxes" class="dropdown-content" >
<ul>
<label clasenter image description heres="labelclass" style="color:cornflowerblue"><u><i class="bi bi-book-half"></i>Courses</u></label>
<li>
<input class="cb" name="searchString1" type="checkbox" id="Int" value="Java" /> Java
</li>
<li>
<input name="searchString2" type="checkbox" id="Int" value="C+" /> C++
</li>
<li>
<input name="searchString3" type="checkbox" id="Int" value="Python" /> Python
</li>
<label style="color:cornflowerblue"><i class="bi bi-people"></i> <u>Gender</u></label>
<li>
<input name="gender" type="checkbox" id="Int" value="Male" /> Male
</li>
<li>
<input name="gender" type="checkbox" id="Int" value="Female" /> Female
</li>
<label style="color:cornflowerblue"><i class="bi bi-sort-alpha-down"></i><u>Sorting</u></label>
<li>
<input name="sortByAz" type="checkbox" id="Int" value="sort" /> Sort by A-Z
</li>
<li>
<input name="sortByZa" type="checkbox" id="Int" value="sort" /> Sort by Z-A
</li>
</p>
<button class="btn btn-outline-success my-2 my-sm-0" type="submit"><i class="bi bi-search"></i> </button>
<button class="btn btn-outline-warning" type="submit" asp-action="Index" asp-controller="Student"><i class="bi bi-house"></i>Clear</button>
</ul>
</div>
</div>
</form>
I tried creating arrays of checked items and Creating Viewbag for each