Version

DefaultValue Property

Default value that's used when no value is specified for a cell of this column.
Syntax
'Declaration
 
Public Property DefaultValue As Object
public object DefaultValue {get; set;}
Example
Following code demonstrates the DefaultValue property of UltraDataColumn.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinDataSource

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim ds As UltraDataSource = New UltraDataSource()
        Dim col As UltraDataColumn = ds.Band.Columns.Add("Col1", GetType(String))

        ' Set the column's DefaultValue to string "Default".
        col.DefaultValue = "Default"

        Dim row As UltraDataRow = ds.Rows.Add()

        ' When no value is set, column's DefaultValue will be used.
        ' Following should print out the string "Default".
        Debug.WriteLine("Before setting cell value = " & row(col))

        row(col) = "Test"
        Debug.WriteLine("After setting cell value = " & row(col))
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinDataSource;
using System.Diagnostics;


		private void button1_Click(object sender, System.EventArgs e)
		{
			UltraDataSource ds = new UltraDataSource( );
			UltraDataColumn col = ds.Band.Columns.Add( "Col1", typeof( string ) );

			// Set the column's DefaultValue to string "Default".
			col.DefaultValue = "Default";
			
			UltraDataRow row = ds.Rows.Add( );

			// When no value is set, column's DefaultValue will be used.
			// Following should print out the string "Default".
			Debug.WriteLine( "Before setting cell value = " + row[ col ] );

            row[ col ] = "Test";
			Debug.WriteLine( "After setting cell value = " + row[ col ] );
		}
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