I have a client request to hide the first 7 columns of a grid if they are the same values as the columns above. I have the logic to check and match the previous row but I can't find a way to iterate through the cells in RowInfo.
I was planning on setting the ForeColor to the BackColor to hide it from the user but keep the value so I can sort correctly. Any suggestions would be greatly appreciated.
Thanks,
Tom
void radGridView1_RowFormatting(object sender, RowFormattingEventArgs e)
{
GridViewRowInfo row = e.RowElement.RowInfo;
if (row.ViewTemplate != this.gridDashboard.MasterTemplate)
{
return;
}
if (lastRow == null)
{
lastRow = row;
return;
}
// Does the current row match the last row?
if (lastRow != null && lastRow != row)
{
bool isMatch = true;
for (int i = 0; i < 8; i++)
{
if (!Object.Equals( row.Cells[i].Value, lastRow.Cells[i].Value))
{
isMatch = false;
}
}
if (isMatch)
{
for (int i = 0; i < 8; i++)
{
// Clear the duplicate cells
// by setting ForeColor = BackColor
}
}
else
{
lastRow = row;
}
}
}
I was planning on setting the ForeColor to the BackColor to hide it from the user but keep the value so I can sort correctly. Any suggestions would be greatly appreciated.
Thanks,
Tom
void radGridView1_RowFormatting(object sender, RowFormattingEventArgs e)
{
GridViewRowInfo row = e.RowElement.RowInfo;
if (row.ViewTemplate != this.gridDashboard.MasterTemplate)
{
return;
}
if (lastRow == null)
{
lastRow = row;
return;
}
// Does the current row match the last row?
if (lastRow != null && lastRow != row)
{
bool isMatch = true;
for (int i = 0; i < 8; i++)
{
if (!Object.Equals( row.Cells[i].Value, lastRow.Cells[i].Value))
{
isMatch = false;
}
}
if (isMatch)
{
for (int i = 0; i < 8; i++)
{
// Clear the duplicate cells
// by setting ForeColor = BackColor
}
}
else
{
lastRow = row;
}
}
}