I am working with TreeList in ASP.NET MVC using DevExpress. Currently the code I have works, but it only adds the same icon on all nodes I would like to add a different icon depending on the Tag
column / cell value.
For example if the Tag
column has the value Visit Summary
, I would like to add in the node an icon related to it.
I leave this image with my tree list and the code below.
settings.Columns.Add("Description").SetDataCellTemplateContent(c =>
{
Html.DevExpress().Image(image =>
{
image.Name = "image" + c.NodeKey;
image.Properties.EmptyImage.IconID = IconID.BusinessobjectsBoFolderSvg16x16;
}).GetHtml();
Html.DevExpress().Label(label =>
{
label.Name = "Label" + c.NodeKey;
object value = DataBinder.Eval(c.DataItem, c.Column.FieldName);
if (value != null)
label.Text = value.ToString() + " ";
}).GetHtml();
});