CartSummary.cshtml render /ShoppingCart?Length=12

Oct 10, 2011 at 6:39 PM

CartSummary partial view render:

<a href="/ShoppingCart?Length=12" id="cart-status">Cart (0)</a>

Where does the "Lenght=12" query string come from?

Oct 31, 2011 at 4:03 PM
Edited Oct 31, 2011 at 4:04 PM

I got it, it's just another bug in this example, in this case in CartSummary.cshtml

@Html.ActionLink("Cart (" + ViewData["CartCount"] + ")",    "Index",    "ShoppingCart",  new { id = "cart-status" })

should be:

@Html.ActionLink("Cart (" + ViewData["CartCount"] + ")",    "Index",    "ShoppingCart", null,    new { id = "cart-status" })

The third parameter "ShoppingCart" is being taken as routeValues, then MVC is using properties of System.String in the url.

 

In general this Music Store is good example, but I've found so many bugs. I think It's breaking the world record of bugs that can be found in an example.

Microsoft should be more careful about the quality of the examples that publish, poor quality as this one only dispel newcomers.