简体   繁体   English

使用MVC3进行页面导航

[英]Page Navigation with MVC3

I'm currently looking for a good way to implement navigation between pages (without using any kind of dialogs) - particularly where a page is shared by more than one other page. 我目前正在寻找一种实现页面之间导航的好方法(不使用任何类型的对话框),尤其是在一个页面由多个其他页面共享的情况下。

Example

There are three pages: 共三页:

  • ProductEdit 产品编辑
  • OrderListItem OrderListItem
  • ProductList 产品列表

The ProductEdit page can be navigated to from both the OrderItemList and the ProductList pages. 可以从OrderItemList和ProductList页面导航到ProductEdit页面。

The ProductEdit page has a cancel and an update action for it. ProductEdit页面具有取消和更新操作。 When the user clicks one of these actions I need control to return back to the page it came from. 当用户单击这些操作之一时,我需要控制权才能返回到其来源页面。

Multiple Levels 多层次

Any ideas on the best way to implement this. 关于实现此目标的最佳方法的任何想法。 I also need to support this working at more than one level. 我还需要在多个层面上支持这项工作。

Related Posting This is all MVC3 related but is very similar to another StackOverflow posting: Web page navigation 相关发布这是与MVC3相关的所有发布,但与另一个StackOverflow发布非常相似: 网页导航

Many Thanks! 非常感谢!

You can use the ProductEdit Page as partial view , and then check the ViewBag.Title to know in which page it came from. 您可以将ProductEdit页面用作部分视图,然后检查ViewBag.Title以知道它来自哪个页面。 For example: 例如:

In OrderListItem Page : 在OrderListItem页面中:

@{ ViewBag.Title = "OrderListItem";}
@Html.Partial("ProductEdit");

and same in ProductList Page. 与ProductList页面中的相同。 In ProductEdit Page check : 在ProductEdit页面中检查:

If ( ViewBag.Title = "OrderListItem")

//send value to your control with the title as paramter... //以标题为参数将值发送到控件中...

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

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