Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
35
Null dates in WinGrid
posted

The data I am listing in the grid has a date field that can contain null dates.  However, instead of displaying a blank cell for a null date, the grid display '1/1/0000'.  Is there any way to get the grid to display a blank cell for a null date?

The same goes for a null value in a number field.  The grid displays zeros when I would just like to have the cell blank.

 Thanks.

DynoComp

Parents
No Data
Reply
  • 10
    posted

    To enable a Infragistics grid date column to allow null value, try the following steps:

    1) In your business object class (a bindable data source that binds to the grid), create a property using the nullable date type:

        Public Property YourOptionalDate() As Nullable(Of Date)

    2) Then set these Infragistics Grid settings:

        Me.UltraGrid1.DisplayLayout.Bands(0).Columns("YourOptionalDate").Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Date
        Me.UltraGrid1.DisplayLayout.Bands(0).Columns("YourOptionalDate").ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.OnMouseEnter
        Me.UltraGrid1.DisplayLayout.Bands(0).Columns("YourOptionalDate").Nullable = Infragistics.Win.UltraWinGrid.Nullable.Nothing

    Then you will get a grid with a optional date column that correctly displays null. Hope it helps.
               
    Bernard Pang

Children
No Data