Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Razor MVC 3 RC2 - WebGrid Actionlink with Dynamic Text

I'm outputting an Actionlink, in a WebGrid, with Dynamic link text and the only way I can get it to work is as follows:

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

Does anyone have a better way of doing this?

like image 805
Foxster Avatar asked Dec 31 '10 12:12

Foxster


1 Answers

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 make a MVC 3 Webgrid with checkbox column?

like image 131
Derek Beattie Avatar answered Oct 07 '22 00:10

Derek Beattie