Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
1.89/5 (2 votes)
See more:
I have tried a lot to change the row background color

Do While i < GridView1.RowCount
Dim row As DataRow = GridView1.GetDataRow(i)



Check if row.Item(Engine #) is duplicate & if duplicate change the row color

GridView1.SelectRow(i)
GridView1.Appearance.SelectedRow.BackColor = Color.Black
'GridView1.Appearance.FocusedRow.BackColor = Color.AliceBlue




i += 1
Loop

but nothing seems to work, can anyone
Posted
Updated 6-Nov-19 5:12am

I Found the answer here and question in simple

Devexpress XtraGrid Set Row Color after validating the contents

http://www.devexpress.com/Support/Center/Question/Details/Q487748
 
Share this answer
 
Hi Change row back color in the GridView's RowStyle event like this

private void advBandedGridView1_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
        {
            if (String.IsNullOrWhiteSpace(advBandedGridView1.GetRowCellValue(e.RowHandle, advBandedGridView1.Columns[0]).ToString())
                || String.IsNullOrWhiteSpace(advBandedGridView1.GetRowCellValue(e.RowHandle, advBandedGridView1.Columns[6]).ToString())
                || advBandedGridView1.GetRowCellValue(e.RowHandle, advBandedGridView1.Columns[6]).ToString().Trim().Length < 10)
            {
                e.Appearance.BackColor = Color.Red;
            }
        }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900