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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:34:45+00:00 2026-05-14T06:34:45+00:00

if i have created a view model and have a partial form that is

  • 0

if i have created a view model and have a partial form that is a create form for the view model. but now i want to take in a list model to my form and be able to loop through each item and depending on one of the properties append a string to teh end of the Name and id fields. or alternatively give each of the items in the list a unique name and id , all using the Html helpers. the reason i wish to do this is because the save method must be able to accept all the entities created in the form post. or should i just loop through and do all craetes and things through Jquery?

  • 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-14T06:34:45+00:00Added an answer on May 14, 2026 at 6:34 am

    You can Model-bind to a collection. You don’t need to give each item a unique Name as such, just append an index to it e.g.

    <% for (int i = 0; i < Model.Products.Count; i++)
    { %>
        <%= Html.TextBox("ID", Model.Products[i].Id) %>
    }%>
    

    Then have you controller accept a IList<Product> and it will automatically populate the collection.

    See Model Binding To A List on Haacked Blog for more info or ASP.NET MVC Model binding to a list.

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

Sidebar

Related Questions

We have created a new List View Style that shows thumbnails from a picture
I have created an iPhone application based on an OpenGL view. Now I would
I have a partial view that has something like this <%= Html.DropDownListFor(m => m.SelectedProductName,
I have a feature which allows the user to create projects and view it
I have created a PHP-script to update a web server that is live inside
I have created a UserControl that has a ListView in it. The ListView is
I have created a few small flash widgets that stream .mp3 audio from an
I have a simple form created using Ajax.BeginForm : <% using (Ajax.BeginForm(Update, Description, new
I have a _form.html.erb partial that comes from the standard rails 3 template for
I have a partial view where I render, if the user has choosen an

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.