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?
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?
Share Improve this question edited Oct 14, 2010 at 21:06 mare 13.1k24 gold badges106 silver badges193 bronze badges asked Oct 14, 2010 at 20:17 JeremyJeremy 46.5k72 gold badges214 silver badges355 bronze badges 1- No, nothing in MVC. How is an "inline" edit different from what you describe with partial views? – bzlm Commented Oct 14, 2010 at 20:49
2 Answers
Reset to default 3Have 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.
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.