我想在网格中添加一列,其中包含多个带有图像中图标的操作链接。链接可见性取决于属性值。
我该怎么做?
像这样使用模板列:
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>");
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>");