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
ASKER CERTIFIED SOLUTION
Avatar of Craig Wagner
Craig Wagner
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo