简体   繁体   English

ASP.NET MVC内联编辑

[英]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). 我正在构建一个MVC 2 Web应用程序,我想在其中显示有关某些信息(父项)以及显示为行的子项详细信息(子项与父项具有多对一关系)。

I have implemented AJAX in MVC before using Ajax.BeginForm and partial views Using this method - with minor changes for MVC 2 release . 在使用Ajax.BeginForm和局部视图之前,我已经在MVC中实现了AJAX。 使用此方法-对MVC 2版本进行了较小的更改

I want to add the ability to edit child rows inline using ajax, but I would like to know how others implement this. 我想添加使用ajax内联编辑子行的功能,但我想知道其他人如何实现此功能。 Are there facilities in MVC that can do this? MVC中是否有可以做到这一点的工具?

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.. 与ASP.NET MVC相比,这是Javascript插件或库的更多要求。

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 . 如果您想要单击链接并进入编辑模式的行为(例如,用文本框替换文本),请查看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. 我使用常规表单发布而不是ajax发布发布数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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