We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Howto:? change backcolor in RowStyle of a DataBoundGrid

I need the row which the mouse is currently over to be highlighted, CellMouseHoverEnter & Leave events are working but dataBoundGrid1.Model.RowStyles[e.RowIndex].BackColor = Color.AliceBlue; does not do anything to change the backcolor of the row. Is there another way to do this?

1 Reply

AD Administrator Syncfusion Team August 7, 2003 03:00 PM UTC

In a GridDataBoundGrid, you cannot set RowStyles as none are saved in this grid. One way to do this would be to track a currentmouserow variable which you could set in the events you are using now. When you change rows, then call grid.RefreshRange to force the grid to repaint the 2 adjacent rows, the new row and the old row. In PrepareViewStyleInfo, check e.RowIndex to see if it is the courrentMouseRow, and if it is, then set the e.Style.BackColor to your color. In this way, you will color the currentmouse row.

Loader.
Live Chat Icon For mobile
Up arrow icon