正在尝试在Grid中添加链接列。
我的尝试:
尝试1
<div class="table-responsive">
@Html.Grid(Model).Columns(columns =>
{
columns.Add(c => c.UserId).Titled(Resources.Resource.user_id);
columns.Add(c => c.UserName).Titled(Resources.Resource.user_name);
columns.Add(c => c.Mailid).Titled(Resources.Resource.mailid);
columns.Add(c => c.Role).Titled(Resources.Resource.role);
columns.Add(c => c.Dept).Titled(Resources.Resource.dept);
columns.Add(c => c.Designation).Titled(Resources.Resource.designation);
columns.Add(c => c.State).Titled(Resources.Resource.city);
columns.Add(c => c.Country).Titled(Resources.Resource.country);
columns.Add()
.SetWidth(30)
.RenderValueAs(data => new HtmlString ("<button type='submit' value=''>Download</button>" ));
}).WithPaging(10).EmptyText("No data found")
</div>
尝试2:
<div class="table-responsive">
@Html.Grid(Model).Columns(columns =>
{
columns.Add(c => c.UserId).Titled(Resources.Resource.user_id);
columns.Add(c => c.UserName).Titled(Resources.Resource.user_name);
columns.Add(c => c.Mailid).Titled(Resources.Resource.mailid);
columns.Add(c => c.Role).Titled(Resources.Resource.role);
columns.Add(c => c.Dept).Titled(Resources.Resource.dept);
columns.Add(c => c.Designation).Titled(Resources.Resource.designation);
columns.Add(c => c.State).Titled(Resources.Resource.city);
columns.Add(c => c.Country).Titled(Resources.Resource.country);
columns.Add()
.SetWidth(30)
.RenderValueAs(data => Html.ActionLink("Edit","Edit",new {id = data.UserId }));
}).WithPaging(10).EmptyText("No data found")
</div>
两者都不起作用。这是怎么了?
正在使用VS 2017, MVC 5