Hi I am having difficulties using Url.Action
method, please see my code below, what am I doing wrong....? (I'm using MVC Razor)
<a href='<%: @Url.Action("Edit", "Student",
new { id = item.DealPostID }) %>'>Hello </a>
Student
is my StudentController
and Edit
is ActionResult
method.
MVC (Model-View-Controller) is a pattern in software design commonly used to implement user interfaces, data, and controlling logic. It emphasizes a separation between the software's business logic and display.
The Model-View-Controller (MVC) framework is an architectural/design pattern that separates an application into three main logical components Model, View, and Controller. Each architectural component is built to handle specific development aspects of an application.
MVC is primarily used to separate an application into three main components: Model, View, and Controller. This level is considered the lowest level when compared with the View and Controller. It primarily represents the data to the user and defines the storage of all the application's data objects.
MVC is a software design pattern built around the interconnection of three main component types: Model, View, and Controller, often with a strong focus on Object-Oriented Programming (OOP) software paradigms. MVC is a framework for building web applications using an MVC Design.
Try this:
@Html.ActionLink("Hello", "Edit", "Student", new { id = item.DealPostID }, null)
That should work out for you.
Remove <%: %>
from your Razor view. Those are WebForms tags.
<a href='@Url.Action("Edit", "Student",
new { id = item.DealPostID })'>Hello </a>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With