Ultrawingrid - how to display #1/1/1800# as blank ( as if null )

Posted by Charles Hankey on Stack Overflow See other posts from Stack Overflow or by Charles Hankey
Published on 2010-06-08T22:49:59Z Indexed on 2010/06/08 22:52 UTC
Read the original article Hit count: 372

Ultrawingrid 9.2 VS2008 .net 3.5

My wingrid uses a bindingsource. All datetimes which are null in SQL Server are delivered to the bindingsource as #1/1/1800#

I would like Ultrawingrid to display this date as blank as it would a null from source.

Also, if the date is null in the grid ( i.e. blanked out ) I would like to update the data source to the date #1/1/1800# ( the framework takes care of getting that date back into the backend as a null )

This seems like it should be a trivial matter but I can find no documentation on just where to intervene so the grid will see a particular date as a null and save a null as a particular date.

This is the direction I've been headed but I don't think either is the right place and I can't even get the syntax to work in the BeforeRowUpdate as I cannot see how to set a value that is passed to the data binding without setting the value of control itself, which I think has to remain null in order to display as blank

Private Sub ugPropMaster_BeforeRowUpdate(ByVal sender As Object, ByVal e As _
   Infragistics.Win.UltraWinGrid.CancelableRowEventArgs) Handles _
   ugPropMaster.BeforeRowUpdate

    If e.Row.Cells.Item("Exdate").Value Is Nothing Then

        e.Row.Cells("Exdate").Value = CDate(#1/1/1800#)

    End If

 End Sub



  Private Sub ugPropMaster_InitializeRow(ByVal sender As Object, ByVal e As _
    Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) Handles _
    ugPropMaster.InitializeRow

    If CDate(e.Row.Cells.Item("Exdate").Value) = CDate(#1/1/1800#) Then
        e.Row.Cells.Item("Exdate").Value = Nothing
    End If

End Sub

Guidance much appreciated

© Stack Overflow or respective owner

Related posts about .NET

Related posts about datetime