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

  • SEARCH
  • Home
  • 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 3852390
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:18:40+00:00 2026-05-19T17:18:40+00:00

Asp.net MVC2: I have many dropdownlists in my mvc application. At first, I started

  • 0

Asp.net MVC2: I have many dropdownlists in my mvc application. At first, I started by creating a table for each one with a unique ID and name and referring to them in the controllers and views. The application got bigger, and it was suggested that I use a lookup table, that contains lookuptype and lookupvalue as compound primary key and fill all the values for the dropdownlists in it. I’ve looked all over the internet, the only method used for mvc is one table for each dropdownlist! Can someone explain to me how I can implement it, and in detail please becoz I’m totally lost. A link to a tutorial would also be great.
I’m using vb.net and linq to sql.

  • 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-19T17:18:41+00:00Added an answer on May 19, 2026 at 5:18 pm

    I actually used a slightly different approach. I created a table that has a composite primary key, LookupName and LookupValue. Then in the datacontext I declared a method that takes the lookupname as a parameter, and then brings a list of lookupvalues whose lookupname match this parameter. In the original table (ex.Contact) I created a field called status, where the selected value will be saved. Then in the controller, I used viewdata to create dropdownlists.

    Example: _db represents the datacontext

    Viewdata(‘Status’)= new selectlist(_db.Getlookupname(‘status’),’lookupname’,’lookupname’)

    and then in the view

    html.dropdownlist(‘status’)

    I also named the dropdownlist with the same fieldname ‘status’ that is found in the target table ‘Contact’.

    And it worked, without any complexity or errors.
    Thanks for the help. And I hope this will be helpful to someone else!

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

Sidebar

Related Questions

I have a table in an ASP.NET MVC2 form. On each row in the
Context: ASP.NET MVC 2.0, C#, SQL Server 2008, IIS7 I have 'scheduledMeetings' table in
ASP.NET MVC routes have names when mapped: routes.MapRoute( Debug, // Route name -- how
We have ASP.NET MVC2 project with EntityFramework mappings. alt text http://www.freeimagehosting.net/uploads/552e05f607.jpg How to delete
I'm using ASP.NET MVC 2. Keeping it simple, I have three payment types: credit
I am a newbie to ASP.net & MVC 2, and have understood the basic
I have an ASP.NET MVC 2 project. I've decoupled layers. I have a service
I am using ASP.NET MVC 2 with nhibernate. I have this Sales class. Sales
I'm implementing a ASP.NET MVC 2 application and I need a grid with the
ASP.NET MVC has been discussed on this forum a few times. I'm about to

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.