Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
1.00/5 (5 votes)
See more:
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

What I have tried:

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

        }
Posted
Updated 16-Jul-23 11:31am
v2
Comments
Graeme_Grant 16-Jul-23 20:09pm    
Asking questions multiple times a week gives the impression that you are not trying very hard to work the problem, and expect others to do it for you. Most of the questions that you ask are easily solved with either reading the official documentation or a quick google search. Programming is problem solving, not asking others to constantly solve your problems for you. How do you think that we learned?
OriginalGriff 17-Jul-23 0:23am    
This is a help vampire: 468 questions, and he still can't do anything for himself.
I'm guessing he lied his way into a job and is using CP to keep him employed ... I don't look at his questions any more.
Graeme_Grant 17-Jul-23 0:40am    
I think that he needs to pick a different career path as programming is not for him.
ahmed_sa 16-Jul-23 21:16pm    
so can you help me please answer this question
Andre Oosthuizen 17-Jul-23 4:36am    
Quote: so can you help me please answer this question

Nope, none of us want to answer your questions anymore based on the above comment - Quote: This is a help vampire: 468 questions, and he still can't do anything for himself to which I agree 100%.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900