如何编辑表格数据(ASP MVC) [英] How to edit tabular data (ASP MVC)

查看:104
本文介绍了如何编辑表格数据(ASP MVC)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要能够编辑的数据表在浏览器中。

I need to be able to edit a table of data in the browser.

我已经看到了MVCContrib有一个HTML助手来解析出表。有用......但是,如果我希望用户能够编辑该表是什么?从我可以看到它并不能帮助那里。

I have seen in MVCContrib there is a HTML helper to render out a table. Useful... but what about if I want the user to be able to edit that table? From what I can see it does not help there.

什么是接近最好的方法?

What is the best way to approach this?

传统形成一个表里面?如果是这样的MVC足够聪明到发布的数据解析回行的集合?如何将这项工作呢?

Traditional FORM with a TABLE inside? If so is MVC smart enough to parse the posted data back into a collection of rows? How would that work anyway?

也许这应该只是切换单击某一行的时候到编辑模式(使用JavaScript等),那么当用户移动到不同的行一个AJAX动作叫提交只是一行。我能想象的逻辑可能会很复杂在这里 - 这将presumably仍然使用的一种形式,但我将不得不把它插入到DOM动态

Or perhaps it should just switch to edit mode when a row is clicked (using javascript etc) then when user moves to a different row an AJAX action is called to submit just the one row. I can imagine the logic could get complex here - this would presumably still use a form but would I have to insert it into the DOM dynamically?

我还需要能够将行添加到该表中。我不要求分页支持。

I also need to be able to add rows to this table. I do not require paging support.

有一个现成的解决方案了吗?

Is there an off the shelf solution out there?

我应该回去Web表单? :)

Should I go back to web forms? :)

推荐答案

看看菲尔哈克的博客里,他描述了如何的模式绑定到一个列表

Take a look at Phil Haack's blog where he describes how to model bind to a list.

也许这可以帮助?

这篇关于如何编辑表格数据(ASP MVC)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆