Html.Awkward
Posted by: K. Scott Allen,
on 17 Feb 2011 |
View original | Bookmarked: 0 time(s)
Ive seen the HTML helpers in ASP.NET MVC drive developers to madness. For example: @Html.ActionLink("Detail", "Detail", "Car", new { id = 5 })
... produces ...
<a href="/Home/Detail?Length=3" id="5">Detail</a>
Notice "Length=3" in the query string? That's probably not what you expected. We see this output because we are calling the ActionLink overload where Car is interpreted as route data and the anonymous object we want to use for route data is instead interpreted as the HTML...