Change Ultragrid row color based on value
New DiscussionI’m trying to highlight all rows when duplicate values are found. When I use the below, it only changes the background of the first row it finds.
I am applying formatting to the grid using presets. I tried removing that but nothing changed.
private void ultraGrid2_InitializeRow(object sender, InitializeRowEventArgs e)
{
var dups = _dtHosts.AsEnumerable()
.GroupBy(r => r[“Hostname”]).Where(gr => gr.Count() > 1).ToList();
foreach (var dup in dups)
{
foreach (UltraGridRow row in ultraGrid2.Rows)
{
if (row.Cells[“Hostname”].Value == dup.Key)
{
row.Cells[“Hostname”].Appearance.BackColor = Color.OrangeRed;
}
}
}
}
Sign In
to post a reply
Replies
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Favorites
0 Replies
6 Created On
Jun 22, 2020 Last Post
8 months, 3 weeks ago