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,
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
0
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:
If you want to use a custom tooltip, you should process the CellMouseMove event.
Consider the following sample code:
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
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
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
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:
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
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
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:
I hope this helps.
Kind regards,
Jack
the Telerik team
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