Avatar of finance_teacher
finance_teacher asked on

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


.......
ASP.NETC#.NET ProgrammingLINQ Query

Avatar of undefined
Last Comment
Craig Wagner

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Craig Wagner

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes