提问人:rh208 提问时间:11/8/2023 最后编辑:LarsTechrh208 更新时间:11/8/2023 访问量:35
如何突出显示重复的列?
How to highlight duplicate columns?
问:
这就是我到目前为止所拥有的,但我只是对它的工作原理感到困惑。
protected void GridView1_PreRender(object sender, EventArgs e)
{
HashSet<string> uniqueValues = new HashSet<string>();
foreach (GridViewRow row in GridView1.Rows)
{
// checking duplicate staring at column 1
string cellText = row.Cells[1].Text;
// Check if we've already seen this value
if (uniqueValues.Contains(cellText))
{
row.Cells[0].CssClass = "duplicate-highlight";
// This value is a duplicate, apply a CSS class
// need to add duplicate file to css file standardDesign.cs
}
else
{
// It's not a duplicate, add it to the set of seen values
uniqueValues.Add(cellText);
}
}
}
我试图让它突出显示重复的列。
答: 暂无答案
评论
HashSet