Ultrawebgrid: Highlight row on MouseOver

To highlight row in Infragistics Ultrawebgrid on mouse over event you just need to follow 4 simple steps:

First, define a class to be used for highlighting, for example:

<style type=”text/css”>.over { BACKGROUND-COLOR: lightcyan }</style>

Second, set mouse over/out handler (either in source or thru designer):

<ClientSideEvents MouseOutHandler=”MouseOutHandler” MouseOverHandler=”MouseOverHandler” />

Third, implement event handlers:

/* highlight row on mouse over */
function
MouseOverHandler(gridName, id, objectType){
     var
ohRow = igtbl_getRowById(id)
      if (ohRow) ohRow.Element.className =
“over”
}

/* return row backcolor on mouse out */
function
MouseOutHandler(gridName, id, objectType){
     var
ohRow = igtbl_getRowById(id)
      if (ohRow) ohRow.Element.className =
“”
}

Fourth (and this is important, see why) set background of the row style to inherit:

<RowStyleDefault BackColor=”Window” BorderColor=”Silver”
     
 BorderStyle=”Solid” BorderWidth=”1px”
       
CustomRules=”background-color:inherit” Cursor=”Default”> …

Now you’re all set! The row will be highlighted on mouse over.

4 replies on “Ultrawebgrid: Highlight row on MouseOver”

  1. This works great, except CustomRules=”background-color:inherit” needs to be in the CellStyle element not RowStyleDefault

  2. @Ted Black
    Worked for me with RowStyleDefault 🙂 Tested it in Infragistics 6.3 CLR2 (where it creates inline style based on RowStyleDefault for each rendered TD tag as well as in Infragistics 9.1 CLR35 (where it creates a single global style for all TR tags).
    Not sure why you would need apply it to individual CellStyle… What version of Infragistics are you using? Can you check the rendered HTML?

  3. Hi,
    It is not working if use Styleset Caribean with EnableAppStyling = true.
    It is not a good idea to use Infragistic grid.
    Ther is no beatifull design for.

  4. @Vadim Never used AppStyling in Infragistics grid, I prefer to use my own CSS classes – this way everything is under control and nothing left to chance.
    As to whether it’s a good idea or not, well, it’s a big wide world out there, full of wonderfull web controls, you’re not tied to Infragistics 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *