I work on asp.net mvc I face issue selected value All requests cleared after display result data and back to Pending Request
so my issue on selected value option if i select option All requests it display all requests success but drop down selected option display as Pending Request
so How to solve issue selected option clear after display data
action GetSelectedDropDownChanged on controller WorkforceRequests hit and catched when make debug and detect value 1 if i select pending request and 2 if i select all request
but issue when select option All request it back to option Pending Request so How to prevent this behaviour from happen
code details
<form action="/WorkforceRequests/GetSelectedDropDownChanged" method="post"> <select class="form-control" id="statusselect" name="statusselect"> <option value="1">Pending Request</option> <option value="2">All requests </option> </select> </form>
on controller WorkforceRequestsController
public async Task<ActionResult> GetSelectedDropDownChanged() //Assuming key in your dropdown is string { string selectedValue = Request.Form["statusselect"].ToString(); List<WorkforceRequest> workforceRequest = new List<WorkforceRequest>(); if (selectedValue == "1") { workforceRequest = Workforce.GetPendingOnPalnningSection(RoleKey.PLS); } else workforceRequest = Workforce.GetAllRequestsOnPalnningSection(RoleKey.PLS); return View(workforceRequest); }