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 6582499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:17:15+00:00 2026-05-25T16:17:15+00:00

I am developing an application in MVC3 which has dropdown lists on quite a

  • 0

I am developing an application in MVC3 which has dropdown lists on quite a few pages to populate selections for specific objects. My question is does it make more sense to contain the collections for the dropdown list in my ViewModel or call a service to populate the dropdowns.

For example, does it make more sense to have this:

public class MyViewModel
{
    public int SelectedFooId { get; set; }
    public IEnumerable<Foo> Foos { get; set; }
}

@Html.DropDownListFor(model => model.SelectedFooId, new SelectList(Model.Foos, "Id", "Name", "-- Select Foo --"))

Or is there a better way to implement this by removing the Foos collection from the view model and populating it with ajax through json or something? If I call a service, can you provide an example of how this would be done? I am still relatively new to MVC and am trying to do everything by best practice as I don’t want to get into any bad habbits.

  • 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-25T16:17:15+00:00Added an answer on May 25, 2026 at 4:17 pm

    That’s a very good way to render drop down lists in an ASP.NET MVC application. You define a view model containing 2 properties : a scalar property to bind the selected value to and a collection to bind the options to. Then you have the controller action populate this view model and pass to the view and inside the view you use the DropDownListFor helper.

    Using AJAX to populate values of a dropdown could be useful when doing some dynamic binding. For example you could do this with cascading drop down lists where the selection on the first ddl would condition the values of the second. Here’s an example of how this could be implemented.

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

Sidebar

Related Questions

I'm developing a MVC3 application which interacts with a db. I'm using a form
I'm currently developing a multi-tiered application, using MVC3 and Spring.NET all of which is
When developing an application which mostly interacts with a database, what is a good
I developing an application in which i calling web services on iphone. I want
I developing an application in which i want to print the values on a
I'm developing an MVC3 application for a university project. I am hoping to use
I am developing application in flex 3 which interacts with the Google feeds to
I am developing an MVC3 application using Visual Studio 2010. I have an aspx
I am developing an ASP.NET MVC3 application with c# and Razor. I created a
we are developing a web application using MVC3 and VS2010. We have some pdf

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.