Remark :
Action Link : Hyperling
Route Link : RouteConfig.cs
1 2 3 |
@Html.ActionLink("Say hellw page", "SayHello","Home", new { msg = "Hello!" }, null) |
1 2 3 |
@Html.RouteLink("back to the Home","Home", new { id = 10 }) |
Samples
1 2 3 4 5 |
@Html.ActionLink("Click here", // <-- Link text "Index" // <-- Action Method Name ) |
1 2 3 |
<a href="/">Click here</a> |
1 2 3 4 5 6 7 8 |
@Html.ActionLink("Click here", // <-- Link text "About", // <-- Action Method Name "Home", // <-- Controller Name null, // <-- Route value null // <-- htmlArguments ) |
1 2 3 |
<a href="/Home/About">Click here</a> |
1 2 3 4 5 6 7 |
@Html.ActionLink("Click here", // <-- Link text "Edit", // <-- Action Method Name new { id=item.CustomerID }, // <-- Route value null // <-- htmlArguments ) |
1 2 3 |
<a href="/Home/Edit/187">Click here</a> |
1 2 3 4 5 6 7 |
@Html.ActionLink("Click here", // <-- Link text "Edit", // <-- Action Method Name new { id=item.CustomerID }, // <-- Route value new {@class="ui-btn"} // <-- htmlArguments ) |
1 2 3 |
<a class="ui-btn" href="/Home/Edit/187">Click here</a> |
1 2 3 4 5 6 7 |
@Html.ActionLink("Click here", // <-- Link text "Edit", // <-- Action Method Name new { id=item.CustomerID }, // <-- Route arguments new {@class="ui-btn", data_val="abc"} // <-- htmlArguments ) |
1 2 3 |
<a class="ui-btn" data-val="abc" href="/Home/Edit/ANTON">Edit</a> |