Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
770
Failed to update BackColor of the first row.
posted

Hi guys.

I have a datagrid with 2 bands, and a select button on the first band. Everytime user clicks on the button, I use ClickCellButton to detect which row index was clicked.

When returning with selected result, I will bind the result in the datagrid. At this time, I need to change the BackColor of the row from first band that was clicked. But unfortunately, the BackColor only can be changed start from index 1. Meaning if the index is 0, the BackColor of it still remain the same.

Below is my codes, please advise.

 

In CellClickButton event

ActiveRowIndex = dgRawMat.ActiveRow.Index

 

In InitializeRow event

If e.Row.Band.Index = 0 Then
            If e.Row.Index = ActiveRowIndex Then               
                e.Row.Appearance.BackColor = Color.Green
                e.Row.Appearance.BackColor2 = Color.DarkSeaGreen
            End If
End If