This code works, but displays "Details" for every row of my table:
@appsGrid.GetHtml(
tableStyle: "table",
headerStyle: "head",
alternatingRowStyle: "alt",
columns: appsGrid.Columns(
appsGrid.Column(columnName: "Code",
header: "",
format: (item) => Html.ActionLink("Details",
"Index",
"ApplicationTechStack",
new {Code = item.Code},
null
),
Howeve开发者_如何学Gor, when I try to change the line to format: (item) => Html.ActionLink(item.Code,
it gives me error. How come? item is of class that has Code property, as visible in other parts - returns routing values just fine...
What needs to be done to display the hyperlink text dynamically? Oh, I'm on MVC 3.
Try this. Displaytext
is your dynamic value.
`columns: appsGrid.Columns(
appsGrid.Column(columnName: "Code",
header: "",
format: (item) => Html.ActionLink((string)item.DisplayText,
"Index",
"ApplicationTechStack",
new {Code = item.Code},
null),
精彩评论