I think I already asked this but the solution didn’t really made sense. Anyway, I have ActionLinks on my views like this:
foreach( var item in Model){
<%: Html.ActionLink(item.Name, "Details", new {id = item.Id}) %>
}
now, when it goes to my Action Details obviously this will be the url
/MyThings/Details/{id}
I was wondering if it’s possible to show the name of that item instead of the id Using a slug? or modifying the global asax like so:
/MyThings/Details/CarKeys
The thing is the names need to be unique, is there a way I can modify the global asax to show the name instead of the id?
Any advice is much appreciated!
Sure, you just have to change your routing rules. Look in your Global.asax.cs file, or in your area registration file, for something like this:
… and change it to something like this:
Then have your action take the name instead of the ID: