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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:04:38+00:00 2026-05-23T20:04:38+00:00

The situation is as follows: I have a ViewModel that has a property that’s

  • 0

The situation is as follows:

  1. I have a ViewModel that has a property that’s a List<Product>, where Product is a class with let’s say properties Property1, Property2 and Property3.
  2. I have to render the ViewModel and I wish to render the List<Product> in an HTML table each row of which has a “Delete” button for that row.
  3. Underneath the afore-mentioned HTML table, there should be 2 buttons:

    3.1 “Add” – used to add a new empty Product to the list

    3.2 “Use default product list” – the List has to be loaded via an AJAX call to the GetDefaultProduct() action of the controller

  4. Clicking on a “Delete“, “Add” or “Use default product list” button should not post the entire page
  5. The model contains some other lists of items as well – for the sake of example: List<Sales>, List<Orders> and so on. I’m hoping I can re-use the solution for the List for those lists as well.

Is there a way to do this with ASP.NET MVC?
If yes, what is the best way to do it with ASP.NET MVC?

I did this with jQuery templating and I managed to implement this with simple operations, but I have to do it in an ASP MVC solution and I’m still trying to get the hang of the technology.
I’ve been reading about the Editor template, RenderAction, Async action and partial views and I’m trying to compose a solution with them and I’ll post it if it works.

Thanks in advance for any suggestions and comments!

UPDATE

The solution lies (as Darin pointed out) in Steve Sanderson’s blog post.
However, it assumes that the reader is aware of under-the-covers way of how a List of objects should be rendered in a CRUD-friendly, indexed manner.

So, in order to help anyone who wants to have an indexed list of omplex objects, I suggest reading mr. Haacked’s blog post: http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx.

After you are done with it, you can move on to Sanderson’s blog. By the way, take a good look at the BeginCollectionItem custom HTML helper – its implementation isn’t a trivial one as one might think.
The demo project is a sight for sore eyes – it’s spot on and easy to understand.
The proposed solution DOES use some jQuery.ajax() calls (for the Add link), but just out of bare necessity.

PS: It’s a bit frustrating that one has to read an explicit article from one of the developers of ASP.NET in order to find out that there’s an implicit CoC (Convention-over-Configuration) in the default model binder – it just knows how to work with Lists, but no out-of-the-box HTML helper (or anything similar) doesn’t let you in on this.

Personally I think that CRUD-friendly rendering of List<object> is a very common scenario, not an edge case so it should be simpler to use and a part of the ASP.NET MVC out-of-the-box machinery.

  • 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-23T20:04:39+00:00Added an answer on May 23, 2026 at 8:04 pm

    I would recommend you reading the following blog post. It would definitely put you on the right track for implementing an editing scenario of a variable length list.

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

Sidebar

Related Questions

Essentially, the situation is as follows: I have a class template (using one template
My situation is as follows. I have a django app that is a CMS,
The situation is as follows in my application I have 2 threads that run
Hi I have document class with property Status (e.g doc.Status) and the situation is
Suppose I have a diamond inheritance situation as follows: class A{ public: virtual void
Interesting situation. I have a Html.Textbox() that I render from a view as follows:
My situation is as follows: I have a script file ( somescript.js ) that
I have a situation as follows <body> Test<br /> test<br /> test1<br /> </body>
Here is my situation, I have a string as follows 'a':1 'b':2 'c':3 I
Picture the following situation. I have an XML document as follows, <Form> <Control Type=Text

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.