Does not hold selected value AA while using pagination. When moving to another page, dropdownlist moves to state All.
Used ViewBag to store the current filter state but no luck.
No idea where to go and change the code to make it work. Can anyone enlighten me the way to do this.
- Public async Task
Index( string searchText, string currentFilter, int? page) - {
- int selectedPage = page ?? 1;
- int bypassCount = (selectedPage - 1) * _pagingOptions.PageSize;
- if (searchText != null) { page = 1; }
- else { searchText = currentFilter; }
- ViewBag.CurrentFilter = searchText;
- }
index
- ="custom-select" asp-for="searchText" value="@(ViewBag.CurrentFilter)">
- >All
- >AA
- >AE
- >AR
- class="col-md-12">
- ="btn btn-primary" type="submit">Search
class="table">
@if (Model.Items.TotalItemCount > 0)Resent Resent Date Created Date - {
- @foreach (var item in Model.Items.ToList())
- {
@Html.DisplayFor(modelItem => resentString) @Html.DisplayFor(modelItem => resentDateString) @Html.DisplayFor(modelItem => createdDateString) - } }
Rajanikant HawaldarPosted Apr 30, 2020, 10:30 AM
Rahul LakshakarPosted Apr 3, 2020, 7:09 AM
Vinay SinghPosted Apr 3, 2020, 2:12 AM
Rahul LakshakarPosted Apr 2, 2020, 1:25 PM
Rajesh YadavPosted Apr 2, 2020, 12:44 PM
Vinay SinghPosted Apr 2, 2020, 11:37 AM