views:

39

answers:

1

In an article titled Inegrating jQueryUI with MVC is this code snippet:

     <li><%= Html.ActionLink("Home", "Index", "Home", 
                  new { title="Home Page" }, null)%></li>

I think the article pre-dates MVC2 release and that might be why i get a syntax errors at the opening brace:

Type or 'With' expected.

thx

A: 

If you want to set the title attribute on the generated html anchor you should inverse the parameters. Don't be confused by routeValues and htmlAttributes parameters.

<%= Html.ActionLink("Home", "Index", "Home", 
    null, new { title = "Home Page" }
)%>

If you want to pass title as query string parameter then your code is fine.

The reason you are getting an exception is unrelated to the Html.ActionLink helper and is somewhere else.

Darin Dimitrov
Thankx - the sample i'm working off of is hard-coding those strings, not passing them in the queryString. He's clearly intending the order of params as shown (the rest of the items in the UL are structured the same way) but perhaps i'm missing an Include - i get the syntax error when using his code - a 'null is not declared' when using yours. any additional thoughts?
justSteve