Get row data when hovering over some cell in the DataGrid

6 posts, 1 answers
  1. Den Duze
    Den Duze avatar
    18 posts
    Member since:
    Nov 2014

    Posted 16 Feb 2017 Link to this post

    Hi,

    Is there some way to get the underlying datasource record when hovering over a cell in the RadGridView?
    If not, is there some way to get all cellvalues of the row of the RadGridViewwhere where I'm hovering over?

    Reason, I display a RadOffice2007ScreenTipElement when hovering over some cell in the RadGridView and I would like to display some information in there.
    For this I need to get to that data BUT I do not want to select that row!!!
    The row that was/is selected must stay selected!!

    regards
    Didier
  2. Dimitar
    Admin
    Dimitar avatar
    2951 posts

    Posted 16 Feb 2017 Link to this post

    Hello Didier,

    The following snippet shows how you can retrieve the row data:
    private void RadGridView1_ScreenTipNeeded(object sender, ScreenTipNeededEventArgs e)
    {
        var cell = e.Item as GridDataCellElement;
        if (cell!= null)
        {
            var data = cell.RowInfo.DataBoundItem;
        }
    }

    I hope this information is useful. Let me know if you need further assistance.

    Regards,
    Dimitar
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Den Duze
    Den Duze avatar
    18 posts
    Member since:
    Nov 2014

    Posted 16 Feb 2017 in reply to Dimitar Link to this post

    Im sure this is because I'm not familiar with the .net programming but my code is in the radGridView1_ToolTipTextNeeded method.
    In that method I can't use e.Item??
    So how do get the GridDataCellElement in the radGridView1_ToolTipTextNeeded method?
  4. Dimitar
    Admin
    Dimitar avatar
    2951 posts

    Posted 16 Feb 2017 Link to this post

    Hello Didier,

    Here is the code for the ToolTipTextNeeded event handler:
    private void RadGridView1_ToolTipTextNeeded(object sender, ToolTipTextNeededEventArgs e)
    {
        var cell = sender as GridDataCellElement;
        if (cell != null)
        {
            Debug.WriteLine(cell.Value);
        }
    }

    Should you have any other questions do not hesitate to ask.

    Regards,
    Dimitar
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  5. Den Duze
    Den Duze avatar
    18 posts
    Member since:
    Nov 2014

    Posted 16 Feb 2017 in reply to Dimitar Link to this post

    Hi Dimitar,

    Yes, that one I also already found but how do I get all values from the other cells (of the same row in the DataSource/grid)
    I need the value from a particular cell (by name) from that row, not from the cell itself.

    Regards
    Didier
  6. Answer
    Dimitar
    Admin
    Dimitar avatar
    2951 posts

    Posted 16 Feb 2017 Link to this post

    Hello Didier,

    Here is how you can access another cell from the same row:
    private void RadGridView1_ToolTipTextNeeded(object sender, ToolTipTextNeededEventArgs e)
    {
        var cell = sender as GridDataCellElement;
        if (cell != null)
        {
            var row = cell.RowInfo;
            var value = row.Cells["Name"];
        }
    }

    Do not hesitate to contact us if you have other questions.

    Regards,
    Dimitar
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top