I have a few ActionLinks that when rendered are getting a length key/value added that appears to indicate the number of characters of the controller name. How can this be removed?
At a guess, you are probably using the wrong overload of Html.ActionLink and are adding to the route parameters instead of the HTML attributes. You need to add a NULL as the fourth parameter before your specify the HTML attributes. Something like:
Html.ActionLink("Title", "Action", "Controller", null ,new { title = "Title"} )
Post your code if this doesn't work.
you need stick stick an extra empty object parameter in before the htmlattributes, something like this off the top of my head
html.actionlink("a","b","c",new {},new {@class = "d"})
Check to see if your using the right overload for Html.ActionLink.
They get tricky because they take any object, even anonymous ones, and transform those into route value dictionaries or html attributes depending on the overload your using. Since it will run and compile fine if you mess these two up its hard to tell if your using the right overload.
If you are passing 'routeValues',
Make sure that 'htmlAttributes' is set to null
.
Html.ActionLink("Title", "Action", "Controller", new {}, null )
Else wrong overload of AcitonLink
is picked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With