This article explains how to call another controller action method using ActionLink in ASP.NET MVC. we need to pass the following parameters in ActionLink are as follows
@Html.ActionLink("Index", "ActionName", "ControllerName", null, new { id = "OT",
style = "color: white" })
- 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" })
I hope this article is useful for all readers. If you have any suggestion then please contact me.
Post a Comment