5

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?

GEOCHET
  • 21,119
  • 15
  • 74
  • 98
Foxster
  • 281
  • 1
  • 3
  • 9

1 Answers1

7

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?

Community
  • 1
  • 1
Derek Beattie
  • 9,429
  • 4
  • 30
  • 44