我正在寻找在 Webgrid 中创建一些超链接。我想让“用户名”列将其值显示为超链接而不是文本。是否可以将@Html.ActionLink 函数合并到下面的 WebGrid 中?
columnName 需要一个字符串,该字符串对应于传递给视图的模型的属性。所以问题是如何把它变成一个链接。
看法:
@model IEnumerable<CIMsWebApp.Client.Group.Entities.IUser>
@{ var grid = new WebGrid(Model, canSort: true, canPage: true, defaultSort: "UserName", ajaxUpdateContainerId: "myUserGrid"); }
@grid.GetHtml(
tableStyle: "dataGrid",
headerStyle: "header",
alternatingRowStyle: "evenRow",
columns: grid.Columns
(
grid.Column(header: "User Name", columnName: "UserName", canSort: false),
grid.Column(header: "Role(s)", columnName: "Rolebuilder", canSort: false),
grid.Column(header: "Active", columnName: "ActiveInd", canSort: false),
grid.Column(header: "Action", format:
@<span><input type="button" class="edit-user" id="@item.PersonId" value="EDIT" />
</span>, canSort: false)
)
)