如何使用动态数据路由来更改父子表的工作流程?
我正在制作一个 ASP.Net 动态数据网站,其中有一个表 Orders 和另一个表 OrderLines。 Orderlines 表与 Orders 有 FK 关系。 这意味着一个订单可以包含零个或多个订单行。
动态数据提供的默认工作流程将允许我执行以下操作:
- 转到订单列表,单击“添加新行”,填写信息,然后单击插入。
- 单击订单列表中的“查看订单行”。 这将我带到该特定订单的空订单行列表。 这就是我要的。
- 单击“添加新行”可以让我为这一特定订单添加一个订单行。 URL 通过 fk_OrderID=nnn 反映了这一点。 预先选择了正确的订单描述。
- 现在,单击“插入”(添加一个订单行)或“取消”,将返回到所有现有订单的订单行列表。 不是我想要的!
我想要的工作流程是我可以不断添加订单行直到完成的工作流程。 这意味着插入和取消重定向应该返回到我正在处理的特定订单的订单行列表。
因此,我的问题是:
如何在 Global.asax 中自定义 ASP.Net 路由机制.cs 以便动态数据按照我想要的方式重定向?
我正在使用动态数据预览 4 刷新 7/24 和 Linq to SQL。
I am making a ASP.Net Dynamic Data website where I have one table, Orders, and another table, OrderLines. The Orderlines table has an FK-relationship back to Orders. This means that one Order may contain zero or more OrderLines.
The default workflow offered by Dynamic Data will let me do this:
- Go to the list of Orders, click "add new row", fill in information, and click Insert.
- Click on "View OrderLines" in the list of orders. This takes me to an empty list of OrderLines for this particular Order. This is what I want.
- Clicking on "Add new row" lets me add one orderline for this particular order. The URL reflects this by saying fk_OrderID=nnn. The correct order description is pre-selected.
- Now, clicking either Insert (adding one orderline), or Cancel, takes me back to the list of OrderLines for all existing orders. Not what I want!
The workflow I want to have, is one where I can keep adding orderlines until I am done. This means the Insert and Cancel redirects should go back to the list of orderlines for the particular order that I am working on.
So, my question is this:
How can I customize the ASP.Net routing mechanism in Global.asax.cs so that Dynamic Data will redirect the way I want it to?
I am using Dynamic Data Preview 4 refresh 7/24 with Linq to SQL.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不认为这会改变路线。 您可以做的就是用您的自定义页面覆盖默认的“插入”页面。 自定义页面将查看是否有任何 QueryString 参数发送给它,并相应地重定向回“列表”页面。
I don't think this would be a change in the routing. What you might do is override the default "Insert" page with your out Custom page. The Custom Page would look to see if any QueryString parameters were sent to it, and redirect back to the "List" page accordingly.