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

Get row data when hovering over some cell in the DataGrid

5 Answers 279 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Den Duze
Top achievements
Rank 1
Den Duze asked on 16 Feb 2017, 09:52 AM
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

5 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 16 Feb 2017, 12:10 PM
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.
0
Den Duze
Top achievements
Rank 1
answered on 16 Feb 2017, 01:22 PM
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?
0
Dimitar
Telerik team
answered on 16 Feb 2017, 01:48 PM
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.
0
Den Duze
Top achievements
Rank 1
answered on 16 Feb 2017, 02:20 PM
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
0
Accepted
Dimitar
Telerik team
answered on 16 Feb 2017, 02:56 PM
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.
Tags
GridView
Asked by
Den Duze
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Den Duze
Top achievements
Rank 1
Share this question
or