Version

Nullable Property

Determines how the control stores null or empty data in the database.
Syntax
'Declaration
 
Public Property Nullable As Nullable
public Nullable Nullable {get; set;}
Remarks

Different databases deal with null values in different ways. Since the UltraGrid is designed to work with a variety of data sources, it has the ability to query the back end and find out which way to store null values. Depending on the type of connection to the database, this can have a significant impact on performance. If you know how the database handles the storage of null values, you can improve performance by setting the Nullable property to either 1 (NullableNull) or 2 (NullableEmptyString). Setting this value to 0 (NullableAutomatic) will provide a greater range of compatibility, but performance will suffer.

If the database does not support null values, and you attempt to force the storage of nulls by setting Nullable to 1 (NullableNull), an error will result. If you encounter problems when you attempt to save a record that contains a null value, you can change the setting of Nullable which should fix the problem. In any case, you should implement error-checking code to insure that the storage operation succeeded.

The setting of this property controls how the UltraWinGrid control will attempt to store the null value. In some cases, the mechanism used for data binding may change the null value before actually committing it to the database.

Example
Nullable indicates what the UltraGrid puts in the cell when the user enters an empty string in that cell. When a cell is emptied out, the UltraGrid puts DBNull when this property is set to Null, empty string ("") when it's set to EmptyString. When it's set to Automatic, the UltraGrid tries to detect if the column allows null and if so it puts DBNull otherwise it puts empty string (""). The UltraGrid may not be able to detect whether underlying column allows null in which case you can explicitly set this property to your liking. Below code sets the Phone column's Nullable to Null.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

  Private Sub Button98_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button98.Click

      ' Get a column.
      Dim column As UltraGridColumn = Me.UltraGrid1.DisplayLayout.Bands(0).Columns("Phone")

      ' Set the Nullable to Null so the UltraGrid
      column.Nullable = Nullable.Null

  End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

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

	// Get a column.
	UltraGridColumn column = this.ultraGrid1.DisplayLayout.Bands[0].Columns["Phone"];

	// Set the Nullable to Null so the UltraGrid
	column.Nullable = Nullable.Null;

}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also