dimanche 19 avril 2015

In ASP.NET MVC5, how can I hide the Action name when an a tag is generated in Razor using Url.Action?

As the title says.


I have a route set up and working fine, which provides a default Action when none is specified. I just want to hide the action from the URL because it's unnecessary clutter.


Setting the "actioName" parameter as null, or "", will just result in the current page's action being substituted instead - which doesn't work.


I'm open to using @Html.ActionLink if that will get me what I need.


If all else fails, I suppose I can deal with writing out the hrefs manually, but this should not be a difficult thing for Razor to do.


Has anyone else come across this and knows what to do?


Aucun commentaire:

Enregistrer un commentaire