This is a migrated thread and some comments may be shown as answers.

RowHoverStyle & OnMouseOver attribute on columns

1 Answer 225 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Wim
Top achievements
Rank 1
Wim asked on 28 Jun 2011, 05:07 PM
Hi,

I have a RadGrid with RowHoverStyle enabled. This works until I add an event handler to the OnMouseOver Event of the columns.

A first question:

Is there a way how I can combine both? Enabling the RowHoverStyle and adding the OnMouseOver attribute to the columns on ItemDataBound? At the moment the HoverStyle isn't applied anymore when hovering over the row.

Another question:
What is the most correct way to add a custom tooltip to the first column and another custom tooltip to the other columns?

This is how I'm doing it today:
Dim item As GridDataItem = e.Item
'apply tooltip on whole row
For i As Integer = 0 To item.Cells.Count - 1
    Dim onMouseOverStr As String = item.Cells(i).Attributes.Item("onmouseover")
    item.Cells(i).Attributes.Add("onmouseover", onMouseOverStr & "fixedtooltip('" & tooltipMessage & "', this, event, '350px');")
    Dim onMouseOutStr As String = item.Cells(i).Attributes.Item("onmouseout")
    item.Cells(i).Attributes.Add("onmouseout", onMouseOutStr & "delayhidetip();")
Next
 
'overwrite first column cell's tooltip
item("First").Attributes.Add("onmouseover", "fixedtooltip('" & global_portal.TooltipReplace(FirstTooltipMessage) & "', this, event, '260px');")
item("First").Attributes.Add("onmouseout", "delayhidetip();")
It works but doesn't seem to be the most correct way.

The last question:
As I have set up the grid to indicate the row on hovering over it (RowHoverStyle = True) and I'm catching the rowclick on itemCommand, I would like the cursor to change to the pointer.

This is how I did it in a normal asp.net grid:
e.Item.Attributes.Add("onMouseOver", "this.style.cursor='pointer'")

But it doesn't seem to work for a Radgrid...

Hope you can help me out with this one.

Thanks,

Wim

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 01 Jul 2011, 03:00 PM
Hi Wim,

Take a look at this help article, it demonstrates the recommended ways to modify the row styles on mouse over/hover:
Set style on mouse over

Best wishes,
Tsvetina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
Wim
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or