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) - } }

Vinay SinghRank #604 · 4K reputationPosted Apr 2, 2020, 7:37 AM EDT
Rajesh Yadav96 reputationPosted Apr 2, 2020, 8:44 AM EDT
Rahul Lakshakar193 reputationPosted Apr 2, 2020, 9:25 AM EDT
Vinay SinghRank #604 · 4K reputationPosted Apr 2, 2020, 10:12 PM EDT
Rahul Lakshakar193 reputationPosted Apr 3, 2020, 3:09 AM EDT
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Apr 30, 2020, 6:30 AM EDT