Set ToolTipText after adding row?

2 posts, 0 answers
  1. Jason
    Jason avatar
    14 posts
    Member since:
    Oct 2011

    Posted 13 Dec 2012 Link to this post

    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
  2. Anton
    Admin
    Anton avatar
    167 posts

    Posted 18 Dec 2012 Link to this post

    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.
Back to Top