I have created a partial view which will show the menu with unordered list. I want to add links to each li element. I have done my research and tried different ways like giving relative path, absolute path etc. but it does not open the view page. It shows 404 error in browser. Am I missing to add something in partial view which can then open the view page on clicking the li tag item.
<li><a href="~/Views/Powershell/PwrCmts.cshtml">Powershell Comments</a></li>
Any guidance would be greatly appreciated.
CodePudding user response:
You should change link like "/Controller/Action".
Code at the below will work fine if the names of action and controller are correct.
<li><a href="/Powershell/PwrCmts">Powershell Comments</a></li>
CodePudding user response:
You should use @url.action() method.