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

Rad Grid Tool Tip Text incorrect after grid sort

2 Answers 21 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Charles
Top achievements
Rank 1
Charles asked on 17 Sep 2014, 03:33 PM
When the original radgrid populates with data and I fire the tooltiptextneeded event the tool tip text is correct. Once I alter the grid, for example, clicking one of the headers to sort the data the tool tip text doesn't follow the rows. The tool tip text stays where it was when the rows were originally rendered. I am obviously missing something here. Do I need to update the radgrid's rows somehow on the sort event to reflect the new row values?

Thanks,
Chuck

Code Example:

Private Sub dgMyIssues_ToolTipTextNeeded(sender As Object, e As Telerik.WinControls.ToolTipTextNeededEventArgs) Handles dgMyIssues.ToolTipTextNeeded
 
       Dim cell As GridDataCellElement = TryCast(sender, GridDataCellElement)
 
       If cell IsNot Nothing AndAlso cell.RowIndex > -1 Then
 
           If dgMyIssues.Rows(cell.RowIndex).Cells("Description").Value Is DBNull.Value Then
               e.ToolTipText = ""
 
           Else
 
               Dim s As String = dgMyIssues.Rows(cell.RowIndex).Cells("Description").Value
 
               If s.Length > 500 Then s = s.Substring(0, 500) & "..."
 
               e.ToolTipText = s
 
               If e.ToolTipText.Length > 75 Then e.ToolTipText = SplitToolTip(e.ToolTipText)
 
           End If
 
       End If
 
   End Sub

2 Answers, 1 is accepted

Sort by
0
Charles
Top achievements
Rank 1
answered on 17 Sep 2014, 03:36 PM
Rad Controls Version 2014.2.715.40 
Visual Studio 2013
VB.NET 4.0
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 22 Sep 2014, 10:26 AM
Hello Charles,

Thank you for writing.

RadGridView exposes two collections that contains data rows:
  • Rows - contains all data rows that belong to RadGridView. Data operations such as grouping, sorting, filtering, etc. do not change the content of the collection or the order in which the row objects exist in the collection.
  • ChildRows. This collection returns the data rows that are currently represented by RadGridView in the order in which they appear. The collection is modified every time a data operation (grouping, sorting, filtering) occurs.

It seems that in the ToolTipTextNeeded event handler you extract the tool tip data accessing the hovered row via the Rows collection. In order to obtain correct data you should use the ChildRows collection.

I hope this information helps. Should you have further questions, I would be glad to help.

Regards, Desislava
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
Charles
Top achievements
Rank 1
Answers by
Charles
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or