LINQ parameters, based on URL string --> ASP.net MVC4 C#

How can I make something like the
below "Create.cshtml" Desired work,
passing search criteria from the URL string ?
---------------------------------------------------------------------------------------------------------------
Current

@model.MWR.Models.MAINT_WORK_REQ

...lots of "MAINT_WORK_REQ" database fields in code, then below....

                 @Html.DropDownList("ProjectID", new List<SelectListItem>
                 {
                    new SelectListItem{ Text="CST031 - LeftHand", Value = "CST031 - LeftHand" },
                    new SelectListItem{ Text="CST031 - RightHand", Value = "CST031 - RightHand" }
                 }
                 )

Open in new window

.......
---------------------------------------------------------------------------------------------------------------
Desired


@model.MWR.Models.MAINT_WORK_REQ

...lots of "MAINT_WORK_REQ" database fields in code, then below....

                 @Html.DropDownListFor("ProjectID", new List<SelectListItem>
                 {
                    display all values from my existing C# 
                    GLOBAL "MWR.Models.Lookup_ProjectID" table
                        select ProjectID
                        from Lookup_ProjectID
                        where ProgramID = 'ABCcorp' // from URL string --> http://localhost:63802/ABCcorp/MAINT_WORK_REQ/Create
                        and active <> 0 // excludes inactive
                 }
                 )

Open in new window


.......
finance_teacherAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Craig WagnerSoftware ArchitectCommented:
Pull the value from the query string in the controller action method and stuff it into the model or ViewBag and then use that in your view.

Having said that, performing that type of business logic in the view isn't a great idea. You should be doing that type of work in the controller and then passing the results to the view through the model, ViewBag, or ViewData.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.