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

Gets or sets the currently selected row

Syntax

Visual Basic (Declaration) 
Public Property SelectedRow As UltraGridRow
C# 
public UltraGridRow SelectedRow {get; set;}

Example

Following code prints out the index of the current selected row of an UltraCombo. SelectedRow is the row that was selected from the drop down. NOTE: If embedding UltraCombo or UltraDropDown inside a UltraGrid (as a value-list), SelectedRow will not return the selected row of a cell in the UltraGrid. It will only return the row that was selected from the standalone UltraCombo on the form.

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

  Private Sub Button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.Click 

      ' Get the selected row.
      Dim row As UltraGridRow = Me.ultraCombo1.SelectedRow

      If Not row Is Nothing Then
          ' Print out the index of the selected row.
          Debug.WriteLine("Current selected row index = " & row.Index)
      Else
          ' If SelectedRow is null, then currently there is no row selected.
          Debug.WriteLine("No row currently selected.")
      End If

  End Sub
C#Copy Code
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void button5_Click(object sender, System.EventArgs e)
{

	// Get the selected row.
	UltraGridRow row = this.ultraCombo1.SelectedRow;

	if ( row != null )
	{
		// Print out the index of the selected row.
		Debug.WriteLine( "Current selected row index = " + row.Index );
	}
	else
	{
		// If SelectedRow is null, then currently there is no row selected.
		Debug.WriteLine( "No row currently selected." );
	}

}

Remarks

In an UltraCombo control, this property determines the currently selected row.

Since an UltraDropDown control services many grid cells at once, this property should generally not be used for the UltraDropDown. Use the UltraGridCell.Value property of the UltraGridCell instead.

The SelectedRow, Infragistics.Win.UltraWinGrid.UltraCombo.Value, and properties are tightly linked together. Changing one will change the others (except in some cases where rows have duplicate values).

See Also