HtmlHelper.Action()
@Html.Action(actionName: "Index")
Index()
@Html.Action(actionName: "Index", routeValues: new {id = 1})
Index(int id)
@(Html.Action("Index", routeValues: new RouteValueDictionary(new Dictionary<string, object>{ {"id", 1} })))
Index(int id)
@Html.Action(actionName: "Index", controllerName: "Home")
Index()
in the HomeController
@Html.Action(actionName: "Index", controllerName: "Home", routeValues: new {id = 1})
Index(int id)
in the HomeController
@Html.Action(actionName: "Index", controllerName: "Home", routeValues: new RouteValueDictionary(new Dictionary<string, object>{ {"id", 1} }))
Index(int id)
in the HomeController
HtmlHelper.ActionLink()
@Html.ActionLink(linkText: "Click me", actionName: "Index")
<a href="Home/Index">Click me</a>
@Html.ActionLink(linkText: "Click me", actionName: "Index", routeValues: new {id = 1})
<a href="Home/Index/1">Click me</a>
@Html.ActionLink(linkText: "Click me", actionName: "Index", routeValues: new {id = 1}, htmlAttributes: new {@class = "btn btn-default", data_foo = "bar")
<a href="Home/Index/1" class="btn btn-default" data-foo="bar">Click me</a>
@Html.ActionLink()
<a href=""></a>
@HtmlHelper.BeginForm()
@using (Html.BeginForm("MyAction", "MyController", FormMethod.Post, new {id="form1",@class = "form-horizontal"}))
<form action="/MyController/MyAction" class="form-horizontal" id="form1" method="post">