Orchard - link to view / action in another module?

Let's say I'm on Module1 -> Controller1 -> View1.

In View1, I want to add a regular hyperlink to Module2 -> Controller2 -> View2.

How to do it?



source to share

1 answer

ASP.NET MVC links point to an action on a controller , not a view. As a result, the result can (but does not have to) return from the given action.

So if your View2 comes back eg. action MyAction on Controller2 sitting in Module2 , then you can easily add a link to this action from anywhere by writing:

@Html.ActionLink("Click Me", 
                 new { area = "Module2" }, 
                 new {})



@Html.ActionLink("Click Me", 
                 new { controller = "Controller2", area = "Module2" })


which is best for you. There are a couple of other possible overrides .

The Route Area property is used in Orchard to specify the name of the target module.



All Articles