如何显示动态Html.ActionLink标签?
此代码有效,但为表的每一行显示“详细信息”:
@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
),
但是,当我尝试将行更改为 格式时: (item) => Html.ActionLink(item.Code,
它给了我错误。怎么回事? item 属于具有 Code 属性的类,如其他部分所示 - 返回路由值就好了... 要动态显示超链接文本需要做什么?哦,我使用的是 MVC 3。
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
),
However, 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个。
Displaytext
是您的动态值。Try this.
Displaytext
is your dynamic value.