ASP.NET MVC主从报名表 [英] ASP.NET MVC Master Detail Entry Form

查看:209
本文介绍了ASP.NET MVC主从报名表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现使用ASP.NET MVC订单输入形式,但面临着很多困难。所有这一切我发现样本与观看主从形式,并没有添加或编辑。

I’m trying to implement an order entry form using ASP.NET MVC but facing a lot of difficulties. All the samples that I found are related to viewing master detail forms, and none for adding or editing.

假设我有两个表:订单和OrderLines所涉及到每个人一个一对多的关系。在主视图中我有一​​个新建按钮,点击它应显示订单字段组成的新秩序观,一个网格,显示订单行,和一个保存按钮时,点击后持续随着整个订单其线条到数据库中。网格应该有三个按钮:添加行,编辑行和删除线。当添加行点击新视图应显示,它允许用户将行添加到订单视图网格线-at这个阶段数据库不affected-。当用户点击编辑线视图将显示允许用户编辑所选行,做更新订单网格线时。

Suppose I have two tables: Order and OrderLines that are related to each others with one-to-many relationship. In the main view I had a "New" button when clicked it should show a new order view composed of the order fields, a grid that shows the order lines, and a "Save" button that when clicked will persist the whole order along with its lines into a database. The grid should have three buttons: "Add Line", "Edit Line", and "Delete Line". When the "Add Line" is clicked a new view should be shown that allows the user to add the line to the order view grid lines –at this stage the database is not affected-. When the user clicks "Edit Line" a view will be shown that allows the user to edit the selected line and when done update the order grid lines.

最困难的问题是:

如何通过订单和订单视图和订单行视图之间的行集?

How to pass the order and its lines collection between the order view and the order line views?

如何根据订单行视图的变化更新的顺序有何看法?

How to update the order view based on changes in the order line view?

和如何坚持看法,并没有数据库之间的变化被卷入?

And how to persist changes between views without the database being involved?

是否有介绍如何实现这一点使用MVC一个具体的例子?

Is there a concrete example that shows how to implement this using MVC?

您的帮助和反馈AP preciated。

Your help and feedback is appreciated.

推荐答案

普莱斯看看我的在asp.net mvc的创造主从表单的博客文章。它还包含演示项目,您可以下载

Pleas have a look at my blog post on creating master detail form in asp.net mvc. it also contains demo project that you can download

这篇关于ASP.NET MVC主从报名表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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