Closed csabaantoni closed 8 years ago
Sure you can. ValueExpression just returns a string of whatever you want to be in the column, so just build the HTML you want and return it. Here is an example of the column definition:
cols.Add("Actions").WithHtmlEncoding(false).WithValueExpression((p, c) =>
{
// here's how to get an action url
string url = c.UrlHelper.Action("action1", "test");
// build whatever html you want
StringBuilder sb = new StringBuilder();
sb.Append("<img src='action1.png' onclick='someFunction()'>");
sb.Append("<img src='action2.png' onclick='someFunction()'>");
// conditional html
if (p.Col4)
{
sb.Append("<img src='action3.png' onclick='someFunction()'>");
}
return sb.ToString();
});
Hi!
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?
Is it possible?
Thanks!