开发者

ASP.NET MVC - Adding querystring "length=" to ActionLinks?

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 re开发者_如何学Cmoved?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜