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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:42:35+00:00 2026-05-26T04:42:35+00:00

I have a Model than contains a collection of items that can be modified.

  • 0

I have a Model than contains a collection of items that can be modified.

I render the collection using a Partial View, which in turn uses EditorForModel to output the HTML for each element in the collection.

@model Footy.Models.EventModel

    <h2>@Model.Team1Name vs @Model.Team2Name</h2>
    @using (Html.BeginForm("Index", "Event"))
    {
        @Html.HiddenFor(m => m.EventID)
        <h1>
            Team 1 Squad</h1>
        @Html.Partial("EventPlayers", Model.Team1Players);
        <h1>
            Team 2 Squad</h1>
   Html.RenderPartial("EventPlayers", Model.Team2Players);

        <input type="submit" value="Confirm Changes" />
    }

Partial View

@model IEnumerable<Footy.Models.PlayerModel>
@Html.EditorForModel()

PlayerModel View

@model Footy.Models.PlayerModel

@Model.PlayerName @Html.DropDownListFor(p => p.ParticipationStatusID, new SelectList(Model.ParticipationTypes, "Key", "Value"))

It all renders correctly, but when the user clicks the input, the controller method is not passed the child collection in the model, e.g. Model.Team1Players is null

What am I missing?

EDIT: Generated HTML is

    <form action="/Footy/Event/Index/1" method="post"><input data-val="true" data-val-number="The field EventID must be a number." data-val-required="The EventID field is required." id="EventID" name="EventID" type="hidden" value="1" />            
<h1>Team 1 Squad</h1>
      si <select data-val="true" data-val-number="The field ParticipationStatusID must be a number." data-val-required="The ParticipationStatusID field is required." name="[0].ParticipationStatusID"><option value="1">Team</option>
    <option value="2">Sub</option>
    <option value="3">Squad</option>
    </select>
    <h1>Team 2 Squad</h1>
 <input type="submit" value="Confirm Changes" />
 </form>

Thanks

I think it is related to this question, which doesn’t yet have an answer: Posting data back to a controller from a Partial View rendered by Ajax

  • 1 1 Answer
  • 1 View
  • 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-26T04:42:36+00:00Added an answer on May 26, 2026 at 4:42 am

    If you inspect the rendered source, can you check that the names and id’s of the rendered child model inputs correspond to the model hierarchy?

    I believe that you will need EditorFor in order for the child models to be properly “namespaced”.

    So in the EventModel view, use something like this:

    @Html.EditorFor(m => m.Team1Players, "EventPlayers")
    

    I am not sure however. I’ve had similar problems with the MVC framework.

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

Sidebar

Related Questions

I have a complex view model which contains a collection of other objects which
I have strange situation - when I'm trying to update model, that can contains
I have a set of columns that applies to more than 1 model. For
Right now, I have more than 25 vertices that form a model. I want
I have a model Goal that has four types of children (which all have
I have a simple Entity data model (using VS2010) that I reverse engineered from
I have a model class which contains an NSMutable array of objects. The controller
I have a model Client which contains an array field. In the client.rb model
I am trying to build a program using model-view-controller. Specifically: I have a state
I have a Model class, which contains Lists of Message s and Signal s.

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.