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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:45:09+00:00 2026-05-31T17:45:09+00:00

I know this question has been asked before, but I haven’t been able to

  • 0

I know this question has been asked before, but I haven’t been able to get the correct HTML rendered based on the answers given.

Related questions:

  • Complex model binding to a list
  • How ASP.NET MVC: How can I bind a property of type List<T>?

Here is how my code is setup:

Model

public class CustomerOrderItem {
    public List<CustomerOrderItemSerialNumber> CustomerOrderItemSerialNumbers { get; set; }
    public int Id { get; set; }
    public string ShipperId { get; set; }
    public string OrderLineNumber { get; set; }
    public string LineNumber { get; set; }

    /// <summary>
    /// Return either an empty string (if no serial numbers already exist) or return the list of serial numbers separated by a line break for display in a textarea input.
    /// </summary>
    public string SerialNumber { get { return CustomerOrderItemSerialNumbers == null ? string.Empty : string.Join("\r\n", CustomerOrderItemSerialNumbers.Select(i => i.SerialNumber)); } }
}

View

<table id="orderItems" class="grid">
    <thead>
        <tr class="gridHeader">
            <th class="lineNumber">Line #</th>
            <th class="quantity">Quantity</th>
            <th class="sku">SKU</th>
            <th class="description">Description</th>
            <th class="serialNumber">Serial Number(s)</th>
        </tr>
    </thead>
    <tbody>
        @for (int i = 0; i < Model.Count; i++) {
            @Html.EditorFor(m => m[i])
        }
    </tbody>
</table>

Editor

<tr class="gridrow">
    <td class="lineNumber">@Model.LineNumber</td>
    <td class="quantity">@Model.QuantityOrdered</td>
    <td class="sku">@Model.SKU</td>
    <td class="description">@Model.Description</td>
    <td class="serialNumber">
        @Html.TextAreaFor(m => m.SerialNumber)
    </td>
</tr>

This setup results in the following HTML (only the relevant part is posted):

<td class="serialNumber">
    <textarea cols="20" name="[0].SerialNumber" rows="2"></textarea>
</td>

The name always renders as [0].SerialNumber, but I need orderItem[0].SerialNumber. I looked at Phil Haack’s sample project and I don’t see how he is getting the parameter name rendered.

  • 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-31T17:45:11+00:00Added an answer on May 31, 2026 at 5:45 pm

    I was passing my list of items to a partial view to make my original view look a bit more clean and concise. If you pass your list as a model to a partial view and try to render it, MVC doesn’t automatically add that parameter name as part of the input name.

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

Sidebar

Related Questions

I know this question has been asked before but I still haven't seen a
I know this question has been asked before, but I ran into a problem.
I know this specific question has been asked before , but I am not
I know this question has been asked a bit before. But looking around I
I know this question has been posted before... but I haven't found any answer
I know this question has been asked before, but none of the previous answers
I know this question has been asked here before, but I don't think those
I know this sort of question has been asked before , but I still
I know this question has been asked here a few times before. But i
I know this question has been asked before but the solutions did not work

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.