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 .
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