Version

Adding Row Description Using Row Preview

Row previewing allows you to add a description to a row.

To add a description to a row:

  1. In order to use row preview, it must first be enabled. The AutoPreviewEnabled property is a property of each Band object in the grid. This can be done in the InitializeLayout event.

In Visual Basic:

Private Sub UltraGrid1_InitializeLayout(ByVal sender As Object, _
  ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) _
  Handles UltraGrid1.InitializeLayout
	Me.UltraGrid1.DisplayLayout.Bands(0).AutoPreviewEnabled = True
End Sub

In C#:

private void ultraGrid1_InitializeLayout(object sender,
  Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
{
	this.ultraGrid1.DisplayLayout.Bands[0].AutoPreviewEnabled = true;
}
  1. You can then set a Description for any Row in the grid.

Typically you would do this inside the InitializeRow event handler so the description is displayed when the row first appears.

In Visual Basic:

Private Sub UltraGrid1_InitializeRow(ByVal sender As Object, _
  ByVal e As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) _
  Handles UltraGrid1.InitializeRow
	e.Row.Description = "Row Description"
End Sub

In C#:

private void ultraGrid1_InitializeRow(object sender,
  Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
{
	e.Row.Description = "Row Description";
}
  1. However, you could also change the description at other times, to give feedback to your users.

In Visual Basic:

Private Sub UltraGrid1_AfterRowInsert(ByVal sender As Object, _
  ByVal e As Infragistics.Win.UltraWinGrid.RowEventArgs) _
  Handles UltraGrid1.AfterRowInsert
	Me.UltraGrid1.DisplayLayout.ActiveRow.Description = _
	  "Data changed in this row will not be added to the " & _
	  "database until you press the Update button."
End Sub

In C#:

private void ultraGrid1_AfterRowInsert(object sender,
  Infragistics.Win.UltraWinGrid.RowEventArgs e)
{
	this.ultraGrid1.DisplayLayout.ActiveRow.Description =
	  "Data changed in this row will not be added to the database" +
	  " until you press the Update button.";
}