Infragistics(R) NetAdvantage(R) Windows Forms
BeforeDisplayDataErrorTooltip Event
See Also  Example E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace > UltraGrid Class : BeforeDisplayDataErrorTooltip Event

BeforeDisplayDataErrorTooltip is fired before displaying data error tooltip.

Syntax

Visual Basic (Declaration) 
Public Event BeforeDisplayDataErrorTooltip As BeforeDisplayDataErrorTooltipEventHandler
C# 
public event BeforeDisplayDataErrorTooltipEventHandler BeforeDisplayDataErrorTooltip

Event Data

The event handler receives an argument of type BeforeDisplayDataErrorTooltipEventArgs containing data related to this event. The following BeforeDisplayDataErrorTooltipEventArgs properties provide information specific to this event.

PropertyDescription
Cancel (Inherited from System.ComponentModel.CancelEventArgs)Gets or sets a value indicating whether the event should be canceled.
Column If the data error tooltip is being displayed for a row (when the user hovers over the the data error icon on the row selector), the Column will be null. If the data error tooltip is being displayed for a cell then this property will return the associated column.
DataErrorInfo Associated IDataErrorInfo instance.
Row Returns the row for which the data error tool tip is being displayed.
TooltipText Gets or sets the text that will be displayed in the data error tooltip.

Example

The following code shows some of the information available in the BeforeDisplayDataErrorTooltip event.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Visual BasicCopy Code
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid


    Private Sub UltraGrid1_BeforeDisplayDataErrorTooltip(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BeforeDisplayDataErrorTooltipEventArgs) Handles UltraGrid1.BeforeDisplayDataErrorTooltip
        ' You can get the instance of the IDataErrorInfo that provided the UltraGrid
        ' with the error using the DataErrorInfo property.
        Dim dataErrorInfo As System.ComponentModel.IDataErrorInfo = e.DataErrorInfo

        ' You can get the underlying list object using the row's ListObject property.
        Dim listObject As Object = e.Row.ListObject

        ' If the UltraGrid is bound to a DataSet or DataTable then the listObjects 
        ' are instances of DataRowView. You can get the underlying DataRow from it.
        Dim drv As DataRowView = Nothing
        Dim dataRow As DataRow = Nothing
        If TypeOf listObject Is DataRowView Then
            drv = DirectCast(listObject, DataRowView)
            dataRow = drv.Row
        End If

        ' You can modify the tooltip text by setting the TooltipText property.
        If Not Nothing Is e.Column Then
            ' If Column is non-null then the tooltip is being displayed for the
            ' error icon of a cell.
            e.TooltipText = "Cell Data Error Tooltip for " & e.Column.Key & ": " & e.TooltipText
        Else
            ' If the Column is null then the tooltip is being displayed for the 
            ' error icon of a row selector.
            e.TooltipText = "Row Data Error Tooltip: " & e.TooltipText
        End If

        ' You can conditionally prevent the displaying of the tooltip by setting 
        ' the Cancel to true.
        If e.TooltipText.Length > 10000 Then
            e.Cancel = True
        End If
    End Sub
C#Copy Code
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;


		private void UltraGrid1_BeforeDisplayDataErrorTooltip(object sender, Infragistics.Win.UltraWinGrid.BeforeDisplayDataErrorTooltipEventArgs e)
		{
			// You can get the instance of the IDataErrorInfo that provided the UltraGrid
			// with the error using the DataErrorInfo property.
			System.ComponentModel.IDataErrorInfo dataErrorInfo = e.DataErrorInfo;

			// You can get the underlying list object using the row's ListObject property.
			object listObject = e.Row.ListObject;
			
			// If the UltraGrid is bound to a DataSet or DataTable then the listObjects 
			// are instances of DataRowView. You can get the underlying DataRow from it.
			DataRowView drv = null;
			DataRow dataRow = null;
			if ( listObject is DataRowView )
			{
				drv = (DataRowView)listObject;
				dataRow = drv.Row;
			}
			
			// You can modify the tooltip text by setting the TooltipText property.
			if ( null != e.Column )
			{
				// If Column is non-null then the tooltip is being displayed for the
				// error icon of a cell.
				e.TooltipText = "Cell Data Error Tooltip for " + e.Column.Key + ": " + e.TooltipText;
			}
			else
			{
				// If the Column is null then the tooltip is being displayed for the 
				// error icon of a row selector.
				e.TooltipText = "Row Data Error Tooltip: " + e.TooltipText;
			}

            // You can conditionally prevent the displaying of the tooltip by setting 
			// the Cancel to true.
			if ( e.TooltipText.Length > 10000 )
			{
				e.Cancel = true;
			}
		}

Remarks

See Also