Razor MVC 3 RC2 - WebGrid Actionlink with dynamic text

I outputted Actionlink, in WebGrid, with dynamic link text, and the only way to get it working:

Grid.Column(header: "Subject", columnName: "Message.Subject", format:(item) => Html.ActionLink(((object)item.Message.Subject).ToString(), "Message", new {Id = 12345 }))

Is there anyone better way to do this?

+5
source share
1 answer

Not much different.

Grid.Column(
    header: "Subject",
    columnName: "Message.Subject",
    format: (item) => Html.ActionLink(
        (string)item.Message.Subject, "Message", new { Id = 12345 }
    )
)

See: How to create an MVC 3 webpage with a checkbox column?

+7
source

All Articles