简体   繁体   中英

ASP.NET MVC Inline Edit

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?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM