Redirecting using @Url.Action in MVC

2k views Asked by At

I have a scenario, where I have to redirect using hyper link in MVC and there I have to add action name, controller name & object name. When I try to enter the object name, It is not finding that object name. How to get the object name in Url.Action?

My Url in UI has to look like this: localhost:00/area/Controller/ActionMethod/ItemId.

Here I need help how to add the Itemid in Url.Action.

1

There are 1 answers

11
Sh.Imran On

@Url.Action is used inside <a> tag.

<a href="@Url.Action("ActionMethod", "Controller", new { itemId = ItemId })" >LinkName</a>