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
70
Set date back to null
posted

I have a grid with a date that is nullable but when I set the date and then want to clear it, it will not let me set it back to null.   How can I do this?

I am using Entity Framework for my data

 

  • 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   

  • 469350
    Suggested Answer
    Offline posted

    If setting Nullable on the column works, then you might want to just get the latest service release. This was a bug that was recently fixed. Setting Nullable is fine, but you should not have to do set it, the grid should be (and is, now) smart enough to recognized nullable types.

  • 69832
    Suggested Answer
    Offline posted

    I'm not certain how the column will deal with nullable types but you should take a look at the UltraGridColumn.Nullable property.