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

Add customise tootip to RadGridView cell on Mouse Hover or Enter.

5 Answers 1355 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Rajeev
Top achievements
Rank 1
Rajeev asked on 16 Apr 2008, 05:27 AM
Hi,

I need to implement a customise tootip on my RadGridView cell when user hover mouse on a particular column cell. A tooltip will be displayed showing data of that row. My ToolTip is a user control and when user hover on cell , respective tooltip is shown. I need to know which event of RadGridView will perform this and how to access cell on which user hover mouse. Please help, i need this urgently. Please let me know if some more information required. Thanks in advance,

5 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 16 Apr 2008, 08:32 AM
Hi Rajeev,

Thank you for this question.

RadGridView supports the standard windows tooltips for its cells. You can set a tooltip to a cell using this code:

void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e) 
    if (e.CellElement.Value != null
    { 
        e.CellElement.ToolTipText = e.CellElement.Value.ToString(); 
    } 

If you want to use a custom tooltip, you should process the CellMouseMove event.

Consider the following sample code:

ToolTip tip = new ToolTip(); 
 
void radGridView1_CellMouseMove(object sender, MouseEventArgs e) 
    GridCellElement cell = (GridCellElement)sender; 
    if (cell.Value != null
    { 
        tip.Show(cell.Value.ToString(), this.radGridView1, e.X, e.Y); 
    } 

I hope this helps. Do not hesitate to contact me again, if you have other questions.

Greetings,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Carlos
Top achievements
Rank 2
answered on 10 Jan 2012, 08:27 PM
when I tried this I got an error : cannot convert RadGridView in GridCellElement

the type of sender is RadGridView what can I do???
I do this because i need to show the text into a RadRichTextBox

private void rgv_Precio_MouseMove(object sender, MouseEventArgs e)
        {
            GridCellElement cell = (GridCellElement)sender;
            if (cell.Value != null)
            {
                rrtb_Ayuda.Text = ayuda[cell.ColumnIndex]; // (cell.Value.ToString(), this.rgv_Usuarios, e.X, e.Y);
            }
        }

ayuda is a string[] where i have the list of text
0
Jack
Telerik team
answered on 12 Jan 2012, 11:55 AM
Hello Carlos,

You are using quite an old version of RadControls for WinForms. In the newer versions we changed the event argument to be the cell where the event occurs. In your version you should use the GetElementAtPoint method to get the cell element. Here is a sample:
void radGridView1_CellMouseMove(object sender, MouseEventArgs e)
{
    GridCellElement cell = this.radGridView1.GetElementAtPoint(e.Location) as GridCellElement;
    if (cell != null && cell.Value != null)
    {
        rrtb_Ayuda.Text = ayuda[cell.ColumnIndex]; // (cell.Value.ToString(), this.rgv_Usuarios, e.X, e.Y);
    }
}

I recommend that you try our latest release which contains many improvements and new controls. We will appreciate also your feedback.

If you have other questions, we will be glad to help.
 
Kind regards,
Jack
the Telerik team

SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

0
Miguel Angel
Top achievements
Rank 1
answered on 26 Oct 2012, 05:12 AM
Which version do you mean?
0
Jack
Telerik team
answered on 29 Oct 2012, 03:04 PM
Hello Miguel,

The version discussed in this particular ticket is Q3 2011, while our current version is Q3 2012. However, I just noticed that there is a mistake in my sample code. The GetElementAtPoint method is part of the ElementTree property of RadGridView. Here is the corrected code:
void radGridView1_CellMouseMove(object sender, MouseEventArgs e)
{
    GridCellElement cell = this.radGridView1.ElementTree.GetElementAtPoint(e.Location) as GridCellElement;
    if (cell != null && cell.Value != null)
    {
        rrtb_Ayuda.Text = ayuda[cell.ColumnIndex]; // (cell.Value.ToString(), this.rgv_Usuarios, e.X, e.Y);
    }
}

I hope this helps.

Kind regards,
Jack
the Telerik team
Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Rajeev
Top achievements
Rank 1
Answers by
Jack
Telerik team
Carlos
Top achievements
Rank 2
Miguel Angel
Top achievements
Rank 1
Share this question
or