I am trying to use the new WebGrid in ASP.NET MVC3 and one of the columns I want to display set of link icons that performs various actions (Edit, View, Delete)... For this
I got it :) .... The issue appears to be in the way C# handles dynamic objects...Lots of users are having a blast with this...
The fix was as simple as casting a correct type on the parameter to my extension helper... So this works:
grid.Column(header: "", format: @@Html.ActionLinkIconForEditAction("Customer", (int)item.Id)
The other trick is to use "built" in "item" object and not provide your own..So, for example, this does not work:
grid.Column(header: "", format: (customer) => @@Html.ActionLinkIconForEditAction("Customer", (int)customer.Id)
Lots of reading, tweaking, learning... Hopefully, next version will have something a lot easier to use when you need to add content to columns that are not coming directly from the model...
Regards Z...