Using Html.ActionLink to call action on different controller

In this Asp .Net MVC tutorial we will learn how to call the action method which is present in the different Controller in ASP.NET MVC using Html.ActionLink
How we can use Html.ActionLink:
@Html.ActionLink("Text To Display","ActionName","ControllerName","OptionalRouteValues","Optional_HTML_Attributes")

Html.ActionLink Example 1

When we want to call Action Method where View and Action method are inside same Controller.
@Html.ActionLink("Contact Us", "EnquiryForm")
This will generates following output:
Contact Us

Html.ActionLink Example 2

When we want to call Action Method which is present in a different controller from the Controller which has created the View.
@Html.ActionLink("Contact Us", "NewActionName", "NewControllerName",new{UserId=1},null)
This will generates following output:
Contact Us

Checkout this tutorial for multiple examples of ActionLink Helper .Net MVC Html.ActionLink tutorial with examples
 
We are nothing without our users ! You can help us offer even more high quality content. Please share our page !
Best quality Asp .Net Ajax Control Toolkit tutorials.

Give your valuable comments.

Name
Email
Comment
5 + 5 =
 
About Us | Terms of Use | Privacy Policy | Disclaimer | Contact Us Copyright © 2012-2022 CodingFusion
75 Important SQL Server queries you should know