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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:01:30+00:00 2026-05-26T15:01:30+00:00

Phil Haack has an article that describes how to set things up so the

  • 0

Phil Haack has an article that describes how to set things up so the default model binder will bind to a collection on a post back:

http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx

The problem I am having is I am not just trying to send a collection back to the Controller action, but a ViewModel with a collection.

I have a class that basically looks like this:

public class MyViewModel
{
public int IncidentNumber { get; set; }
public string StoreId { get; set; }
public string RepId { get; set; }
public string OrderStatus { get; set; }
public CustomerViewModel Customer { get; set;
//... other properties and SelectLists for binding

public IEnumerable<OrderItemViewModel> OrderItemViewModels { get; set; }

I can actually get the CustomerViewModel data back on a postback, but the list of OrderItemViewModels is empty. How do I get those back? Phil’s article isn’t helping there.

  • 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-26T15:01:31+00:00Added an answer on May 26, 2026 at 3:01 pm

    I had a similar problem here MVC binding to model with list property ignores other properties which was solved by using the following code within the view

    <div class="editor-field">
    @for (int i = 0; i < Model.MyCollection.Count(); i++)
    {
        @Html.HiddenFor(m => m.MyCollection[i].Id)
        @Html.HiddenFor(m => m.MyCollection[i].ParentId)
        @Html.HiddenFor(m => m.MyCollection[i].Name)
        @Html.TextBoxFor(m => m.MyCollection[i].Value)
    }
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that ASP.NET MVC 1.0 is bin-deployable as explained in Phil Haack's article.
I've based my work on Phil Haack's article here: http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx I've also looked over
Phil Haack has an excellent blog post on how to use JSON, data binding,
This is hopefully a one liner. I've read Phil Haack's article http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx and other
I've read Phil Haack's post on custom client-side validation in ASP.NET MVC 2. I
I've been spending some time looking at Phil Haack's article on Grouping Controllers very
I'm reading Phil's blog post about GIT submodules, which will be really helpful to
Phil Haack's blog entry describes this process using ASP.NET MVC 2's futures and Crockford's
I'm using Phil Haack's URL routing for WebForms and I would like to define
I'm working on a new project where I want to use Phil Haack Areas

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.