views:

222

answers:

1

All, Doing some experimenting with Spark and MVC within NerdDinner. The normal/aspx view works well, and I haven't touched any of the controller code so I'm pretty sure it's not that.

<viewdata model="System.Collections.Generic.IEnumerable[[NerdDinner.Models.Dinner]]"/>
<set Title="'Upcoming Dinners'"/>
<content:main>

<li each="p in Model">
!{Html.ActionLink(p.Title, 'Details', 'Dinners')}
</li>

</content:main>

Given the code above, the ActionLink gets rendered as http://serverName/Controller/Action/ Which is good. I start hitting a wall when I try to provide the ID to my action method. As far as I can tell from the Spark sample docs, I should be able to do something like this:

!{Html.ActionLink(p.Title, 'Details', 'Dinners', new {id = p.DinnerID} )}

However, that throws an exception: " unexpected token '{' "

I'm hoping it's something silly I'm missing...any suggestions?

A: 

I believe there should be another parameter to Html.ActionLink for HTML attributes on the action link. Try:

!{Html.ActionLink(p.Title, 'Details', 'Dinners', new {id = p.DinnerID}, null )}
David Longnecker