Infragistics2.WebUI.WebDataInput.v7.3
DataMode Property
See Also  Example
Infragistics.WebUI.WebDataInput Namespace > WebDateTimeEdit Class : DataMode Property

Name of property used to wrap the Value property.

Syntax

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

Remarks

Default value is set to the Date.

That property is designed to be used when this editor is embedded into grid or other control.

Example

The DataMode property allows to define object that is used to get/set the Value property of the WebDateTimeEdit.

Visual BasicCopy Code
Protected WithEvents WebDateTimeEdit1 As Infragistics.WebUI.WebDataInput.WebDateTimeEdit
Protected WithEvents WebDateTimeEdit2 As Infragistics.WebUI.WebDataInput.WebDateTimeEdit

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    If Me.Page.IsPostBack Then Return
    ' Note: any change of any property at run time increases size of
    ' the hidden viewstate passed to client.
    '
    ' Configure WebDateTimeEdit1 to use the edit-mode-text (String) for the Value property
    Me.WebDateTimeEdit1.DataMode = Infragistics.WebUI.WebDataInput.DateDataMode.EditModeText
    ' If EditModeFormat pattern is dd/MM/yyyy, then following line will
    ' set date in control to the February 19, 1955
    Me.WebDateTimeEdit1.Value = "19/2/1955"
    ' Following line will be valid and the value will contain
    ' the String object rather than the DateTime
    Dim value As String = Me.WebDateTimeEdit1.Value
    '
    ' Set min and max date limits
    Me.WebDateTimeEdit1.MinValue = New DateTime(1955, 2, 19)
    Me.WebDateTimeEdit1.MaxValue = New DateTime(2055, 2, 19)
    '
    ' Set prompt char, do not allow null value
    Me.WebDateTimeEdit1.PromptChar = '+'
    Me.WebDateTimeEdit1.Nullable = False
    '
    ' Get edit mode text.
    ' For date 2/9/200 it can be string similar to "+2/+9/200+"
    Dim value2 As String = Me.WebDateTimeEdit1.EditModeText
    '
    ' Get text in control.
    Dim value3 As String = Me.WebDateTimeEdit1.Text
    '
    ' Show spin buttons
    Me.WebDateTimeEdit1.SpinButtons.Display = Infragistics.WebUI.WebDataInput.ButtonDisplay.OnLeft
    '
    ' Modify text that dispayed when WebDateTimeEdit2 has null value
    Me.WebDateTimeEdit2.NullText = "None"
    '
    ' Consider date valid when only first 2 fields are entered
    Me.WebDateTimeEdit2.MinimumNumberOfValidFields = 2
    '
    ' Use last good date when not all required date fields are entered
    Me.WebDateTimeEdit2.UseLastGoodDate = True
    '
    ' Use sortable format to display value
    Me.WebDateTimeEdit2.DisplayModeFormat = "s"
    '
    ' Use default short-date, short-time format to edit value
    Me.WebDateTimeEdit2.EditModeFormat = "g"
    '
    ' Use last good date when not all required date fields are entered
    Me.WebDateTimeEdit2.UseLastGoodDate = True
End Sub
C#Copy Code
protected Infragistics.WebUI.WebDataInput.WebDateTimeEdit WebDateTimeEdit1; 
 
private void Page_Load(object sender, System.EventArgs e) 

    if(this.Page.IsPostBack) 
        return; 
    // Note: any change of any property at run time increases size of 
    // the hidden viewstate passed to client. 
    // 
    // Configure WebDateTimeEdit1 to use the edit-mode-text (String) for the Value property 
    this.WebDateTimeEdit1.DataMode = Infragistics.WebUI.WebDataInput.DateDataMode.EditModeText; 
    // If EditModeFormat pattern is dd/MM/yyyy, then following line will 
    // set date in control to the February 19, 1955 
    this.WebDateTimeEdit1.Value = "19/2/1955"; 
    // Following line will be valid and the value will contain 
    // the String object rather than the default DateTime 
    string value = (string)this.WebDateTimeEdit1.Value; 
    // 
    // Set min and max date limits 
    this.WebDateTimeEdit1.MinValue = new DateTime(1955, 2, 19); 
    this.WebDateTimeEdit1.MaxValue = new DateTime(2055, 2, 19); 
    // 
    // Set prompt char, do not allow null value 
    this.WebDateTimeEdit1.PromptChar = '+'; 
    this.WebDateTimeEdit1.Nullable = false; 
    // 
    // Get edit mode text. 
    // For date 2/9/200 it can be string similar to "+2/+9/200+" 
    string value2 = this.WebDateTimeEdit1.EditModeText; 
    // 
    // Get text in control. 
    string value3 = this.WebDateTimeEdit1.Text; 
    // 
    // Show spin buttons 
    this.WebDateTimeEdit1.SpinButtons.Display = Infragistics.WebUI.WebDataInput.ButtonDisplay.OnLeft; 
    // 
    // Modify text that dispayed when WebDateTimeEdit2 has null value 
    this.WebDateTimeEdit2.NullText = "None"; 
    // 
    // Consider date valid when only first 2 fields are entered 
    this.WebDateTimeEdit2.MinimumNumberOfValidFields = 2; 
    // 
    // Use sortable format to display value 
    this.WebDateTimeEdit2.DisplayModeFormat = "s"; 
    // 
    // Use default short-date, short-time format to edit value 
    this.WebDateTimeEdit2.EditModeFormat = "g"; 
    // 
    // Use last good date when not all required date fields are entered 
    this.WebDateTimeEdit2.UseLastGoodDate = true; 

 

See Also