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

Set ToolTipText after adding row?

1 Answer 58 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 14 Dec 2012, 01:15 AM
With RadGridView, Is there a way to set the ToolTipText value for a certain cell immediately after adding a row? For example:

int rowIndex = RadGridView1.Rows.Add("column1Text", "column2Text", "Column3Text");
 
RadGridView1.Rows[rowIndex].Cells["FirstColumn"].?? (ToolTipText property) = "ToolTipValue";

Is there any way to set the ToolTipText property for a certain cell of that row?

Thanks,
--Jason

1 Answer, 1 is accepted

Sort by
0
Anton
Telerik team
answered on 18 Dec 2012, 02:31 PM
Hello Jason,

Thank you for writing.

In this case you can use the ToolTipTextNeeded event of the grid to achieve the desired behavior. For example:
public Form1()
{
    InitializeComponent();
 
    this.radGridView1.ToolTipTextNeeded += new Telerik.WinControls.ToolTipTextNeededEventHandler(radGridView1_ToolTipTextNeeded);
}
 
 
private void radGridView1_ToolTipTextNeeded(object sender, Telerik.WinControls.ToolTipTextNeededEventArgs e)
{
    GridDataCellElement dataCell = sender as GridDataCellElement;
 
    if (dataCell != null)
    {
        if (dataCell.ColumnInfo.Name == "Name")
        {
            e.ToolTipText = "yourCustomText";
        }
    }
}

I hope this helps.

All the best,
Anton
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
Tags
GridView
Asked by
Jason
Top achievements
Rank 1
Answers by
Anton
Telerik team
Share this question
or