Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3756332
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:50:08+00:00 2026-05-19T09:50:08+00:00

Is there any better approach than what I am currently doing here: MVC Controller

  • 0

Is there any better approach than what I am currently doing here:
MVC Controller action creates a select list as:

 ProductsDDL.Select(rp => new SelectListItem 
{ Value = Model.RawMaterialID.ToString() + "," + plant, Text = Model.FinishedProductName });

And HTML rendered as:
        <select id="Products" name="Products">
        <option value="3,PLANT1">Finished Product1</option>
        <option value="4,PLANT2">Finished Product2</option>
        <option value="7,PLANT3">Finished Product3</option>
        </select>

On selection change, I use Jquery $.GetJSON to populate another drop down list. The reason I am concatinating PlantID with RawMaterialID is to avoid long query processing time.
On Post to action(string RawIDPlantID), I use Split(‘,’) to get RewMaterialID & PlantID

Other options are to use session to hold PlantID or input hidden field in MVC view.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T09:50:09+00:00Added an answer on May 19, 2026 at 9:50 am

    I typically stay away from using commas as a delimiter in values that represent a single entity, and save the commas delimiting a list of multiple ids. In cases such as yours, I end up using an underscore. Then, should I need to comma separate a list of the IDs, it’s easier on the eyes and to parse. But that’s completely subjective and up to you, as the developer.

    For example

    3_PLANT1,4_PLANT2,7_PLANT3
    

    is easier to eyeball

    3,PLANT1,4,PLANT2,7,PLANT3
    

    And that was as much criticism as I could muster about your code. The rest of it I’d use, and have used in the past.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any better alternative for doing string formatting in VC6, with syntax checking
Do I use varchar(36) or are there any better ways to do it?
I have lots and lots of data in various structures. Are there any better
Having the hours and minutes, is there any easier or better way to set
Are there any VC++ settings I should know about to generate better PDB files
Is there any mechanism for doing a JOIN between an in-memory collection and entity
Is there any way to check whether a file is locked without using a
Is there any free or commercial component written in .NET (no COM interop) that
Is there any query which can return me the number of revisions made to
Is there any efficiency difference in an explicit vs implicit inner join? For example:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.