Antoni Csaba
Antoni Csaba

Reputation: 11

MVCGrid.Net - More action link in a column with valueexpression

I want to add a column to the grid with more than one action link with icons like in image. And links visibility depend on a property value.

How can I do it?

enter image description here

Upvotes: 0

Views: 579

Answers (2)

DenisJC
DenisJC

Reputation: 39

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>");

Upvotes: 1

Mahyar Pasarzangene
Mahyar Pasarzangene

Reputation: 383

use template column like this :

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>");

Upvotes: 1

Related Questions