How to Call Another Controller View Using ActionLink In ASP.NET MVC

In this article we will learn how to Call Another Controller View Using ActionLink In ASP.NET MVC.  we need to overload ActionLink Method are as follows


@Html.ActionLink("Index", "ActionName", "ControllerName", null, new { id = "OT",
style = "color: white" })


In the above code
  •     Index is the ActionLink Name
  •     ActionName is the View name or ActionResult Name.
  •     ControllerName will be name of our controller .
after implementing the  in parent view entire code will be look like as follows

Parentview.Cshtml

 
@{
    ViewBag.Title = "Parentview";
}

<h2>Parentview</h2>
@*To call same same controller view*@
@Html.ActionLink("Index", "ActionName")

@*To call another controller view*@
@Html.ActionLink("Index", "ActionName", "ControllerName", null, new { id = "OT",
 style = "color: white" })

Summary
I hope this article is useful for all readers. If you have any suggestion then please contact me.

Post a Comment

www.CodeNirvana.in

Protected by Copyscape Online Copyright Protection
Copyright © Compile Mode