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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:15:36+00:00 2026-06-01T23:15:36+00:00

My ultimate question is this – should a model binder populate all of the

  • 0

My ultimate question is this – should a model binder populate all of the model, or only the bits that are being posted, leaving the controller to populate the rest?

For example, I am adding a product in my system and on the form i want the user to select which sites the new product will appear on. Therefore, in my model I want to populate a collection called “AllAvailableSites” to render the checkboxes for the user to choose from. I also need to populate the model with any chosen sites on a post in case the form does not validate, and I need to represent the form showing the initial selections. It would seem that I should let the model binder set the chosen sites on the model, and (once in the controller method) I set the “AllAvailableSites” on the model. Does that sound right? It seems more efficient to set everything in the model binder but someone is suggesting it is not quite right.

I am grateful for any advice; I have to say that all the MVC model binding help online seems to cite really simple examples, nothing complicated.

Also, do I really need a GET and a POST version of a method? Can’t they just take the same view model? Then I check in my model binder if it is a GET/POST, and populate all the model accordingly.

  • 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-06-01T23:15:37+00:00Added an answer on June 1, 2026 at 11:15 pm

    Your initial conclusion is sound. A model binder should only worry about creating an instance of a model and populating its properties with the values it has available to it from the action context (for example, post values), and then performing validation. Your controller is then responsible for populating any additional values required for the view, such as your list of available sites.

    I’m not entirely sure what you mean about needing separate GET/POST methods. If you are saving or creating an instance of a model, you should be posting, so it would seem the GET part is irrelevant. Unless you mean something like:

    [HttpGet, ActionName("Edit")]
    public ActionResult Edit(MyModel model)
    {
       return View(model);
    }
    
    [HttpPost, ActionName("Edit")]
    public ActionResult SaveEdit(MyModel model)
    {
       // validate and save, then
       return View(model);
    }
    

    Perhaps you are wondering if you can just combine them into one action and just figure out if they are viewing the edit form or posting the results of the edit form within the action. I would strongly encourage you not to do this. There is a variety of reasons, but let’s just keep it at that; don’t do it.

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

Sidebar

Related Questions

Background I admit, this question stems from an ultimate lack of deep understanding of
This is not a programming question per se, although the ultimate goal is to
My ultimate aim is to have a table that looks like this: Maturity Band
This sounds related to this question , but they aren't the same thing. That
this will be the first question I've posted here so pardon any unintended lapses
I have an issue that seems to be identical to this question . I
Firstly, this seems like something that should have been asked before, but I cannot
My ultimate goal is to have a menu that adds a class to the
My ultimate goal is to do this programmatically, but as a sanity check I'm
Here is my ultimate goal... to take this xml file.. <?xml version=1.0?> <Songs> <Song>

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.