Answered by:
Href to Details View

Question
-
User2074931137 posted
I would like to be able to click on the first property below and have it go to the details link
<td> @Html.DisplayFor(modelItem => item.DocumentMenuCategoryDisplay) </td>
+
<td> @Html.ActionLink("Details", "Details", new { id = item.DocumentMenuID }) </td>
This link below works. I would like to substitute in the code below the Details above in place of DocumentMenuAcess below so that the DocumentMenuCategoryDisplay goes to the Details view.
( I frequently use the code format below a property to go to a url. I just don't know how to work in the Details link.)
<td> <a href=@Html.DisplayFor(modelItem => item.DocumentMenuAccess)>@Html.DisplayFor(modelItem => item.DocumentMenuCategoryDisplay)</a> </td>
Thursday, June 13, 2019 11:30 AM
Answers
-
User2074931137 posted
.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, June 24, 2019 12:21 PM
All replies
-
User1724605321 posted
Hi 3v3rhart,
Could you please explain more about your requirement , do you want to click the a tag and pass parameter ?
Best Regards,
Nan Yu
Friday, June 14, 2019 2:55 AM -
User585649674 posted
Action link creates <a> tag.
First parameter is text, second parameter is action, third is controller
you can try something like below
@Html.ActionLink("Details", "Details", new { id = item.DocumentMenuID })
@Html.ActionLink(item.DocumentMenuCategoryDisplay, "<actionname>","<controllername>", new { <paramname> = item.DocumentMenuAccess })
Friday, June 14, 2019 3:26 AM -
User-1038772411 posted
Can Please Try this one hope its work fine for you
<li> <a href="@Url.Action("Index", "Users")" class="elements"> <span>Clients</span> </a> </li>
Or
Please refer below link it will help to find your answer
https://stackoverflow.com/questions/17671105/asp-mvc-href-to-a-controller-view
Friday, June 14, 2019 4:34 AM -
User2074931137 posted
.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, June 24, 2019 12:21 PM