How to use ASP.Net - Html.ActionLink ()

Ok, I'm pretty new to ASP.Net/MVC 2. Can anyone explain how to use Html.ActionLink? I understand that the first parameter is the displayed text, and for the second, what is called the action name

+4
source share
1 answer

The user action in asp.net MVC is based on controllers and actions that allow you to create pages (or links) for specific sections.

For example, you might need a product editing page so that you have a Product Controller with Edit Action . Then you can create an HTML ActionLink that directs the user to this page.

As a result, "action" will be the ActionResult method that you want to direct your user to.

<%: Html.ActionLink("Edit Product", "Edit", "Product") %> public class ProductController : Controller { public ActionResult Index() // Index is your action name { } public ActionResult Edit(int id) // Edit your product { } } 
+2
source

Source: https://habr.com/ru/post/1332616/


All Articles