views:

81

answers:

2

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?

A: 

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.

mare
+1  A: 

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.

Steve Michelotti
Very interesting post, thank you. Nice and clean. I am hoping to be able to do something similar, but edit one row at a time. I think this is a good start and I can use it to get where I need to go.
Jeremy