Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Puzzling ... why do most of my links, in ASP.NET MVC, have Length=4 appended to them?

Why does the following code:

<%= Html.ActionLink("[Click Here For More +]", "Work", "Home", new { @class = "more" }) %>

render as:

<a class="more" href="/Home/Work?Length=4">[Click Here For More +]</a> 

Where is that "Length=4" coming from?

Update

If I remove the new { @class = "more" }, I don't get that Length=4 parameter.

like image 570
mattruma Avatar asked Mar 10 '09 12:03

mattruma


2 Answers

I've had this happen before. If you look at the overload you're actually using it's probably not the one you want.

Try...

<%= Html.ActionLink("[Click Here For More +]", "Work", "Home", null, new { @class = "more" }) %>
like image 145
Chad Moran Avatar answered Nov 11 '22 19:11

Chad Moran


I look at the overloads for ActionLink and changed the code to look like:

    <%= Html.ActionLink("[Click Here For More +]", "Work", "Home", null, new { @class = "more" }) %>

Added a "null" for the route values. This seems to work. Not sure though what this might affect.

like image 30
mattruma Avatar answered Nov 11 '22 18:11

mattruma