0

我想在网格中添加一列,其中包含多个带有图像中图标的操作链接。链接可见性取决于属性值。

我该怎么做?

在此处输入图像描述

4

2 回答 2

1

像这样使用模板列:

cols.Add("Actions").WithSorting(false)
.WithHeaderText("َActions")
.WithHtmlEncoding(false)
.WithValueTemplate("<a href='{ControllerName}/{Action}/{Model.Id}' title='View'><i class='fa fa-eye'></i></a> | <a href='{ControllerName}/{Action}/{Model.Id}' title='Edit'><i class='fa fa-edit'></i></a> | <a href='{ControllerName}/{Action}/{Model.Id}' title='delete'><i class='fa fa-times'></i></a>");
于 2016-03-27T10:29:43.257 回答
1
cols.Add()
    .WithColumnName("Actions").WithSorting(false)
    .WithHeaderText("Actions").WithHtmlEncoding(false)
    .WithValueExpression(i => i.ID.ToString())
    .WithValueTemplate(" <a href = 'ControllerName/Details/{value}' title='View'>View</a> |"
                + " <a href = 'ControllerName/Edit/{value}' title='Edit'>Edit</a> |"
                + " <a href = 'ControllerName/Delete/{value}' title='Delete'>Delete</a>");
于 2018-04-09T12:34:42.577 回答