Reputation: 46410
I am building an MVC 2 web app, where I want to display information about something (the parent) as well as child details which are displayed as rows (children have a many to one relationship to the parent).
I have implemented AJAX in MVC before using Ajax.BeginForm and partial views Using this method - with minor changes for MVC 2 release.
I want to add the ability to edit child rows inline using ajax, but I would like to know how others implement this. Are there facilities in MVC that can do this?
Upvotes: 2
Views: 5813
Reputation: 5213
Have a look at this post here. From what you're describing it's exactly what you need for your scenario. You can not only edit items inline but also add/remove item dynamically.
Upvotes: 3
Reputation: 13083
This is more of a requirement for Javascript plugin or library than ASP.NET MVC..
If you want the behaviour where you click on link and get into edit mode (like replace text with textbox) take a look at Jeditable.
Though I don't use it, I just create (for example, in a table) one row with fixed text and another with textboxes and then hide the one with textboxes and I only display it when user click on Edit link. I have a save link in the edit row and when this is clicked I just hide the edit row. I post the data using regular form post not ajax post.
Upvotes: 2