Infragistics2.Win.UltraWinGrid.v8.3
Nullable Property
See Also  Example
Infragistics.Win.UltraWinGrid Namespace > UltraGridColumn Class : Nullable Property

Determines how the control stores null or empty data in the database.

Syntax

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

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.

Visual BasicCopy Code
     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
C#Copy Code
       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;

       }

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.

See Also

E-mail your feedback on this topic.

Opinion about our help? Take our survey.

Copyright © 1996-2008 Infragistics, Inc. All rights reserved.

Build Version: 8.3.20083.1000