Dates displayed as 01/01/1800


Author
Message
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Ross,

Thanks for sharing this tip, very nice.

Edhy Rijo

Ross L. Rooker, Sr.
Ross L. Rooker, Sr.
StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)
Group: Forum Members
Posts: 153, Visits: 462
FYI... I solved my issue by adding the following to the Infragistics grid InitializeRow method:

for (int i = 0; i <= e.Row.Cells.Count - 1; i++)

{

    if (e.Row.Cells[i].Value.ToString() == "1/1/1800 12:00:00 AM")

    {

       e.Row.Cells[i].Hidden = true;

    }

}

For a regular .net DataGrid I added this to the Cell Formatting event:

if (e.ColumnIndex >= 0)

{

       if (e.Value != null)

       {

            if (e.Value.ToString() == "1/1/1800 12:00:00 AM")

           {

                e.Value =
"";

           }

       }

}

And actually I took the above code, moved it to a static class and called it from there to minimize the coding.

This gets rid of the ugly 1/1/1800 from grids.


Ross L. Rooker, Sr.
Ross L. Rooker, Sr.
StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)
Group: Forum Members
Posts: 153, Visits: 462
I could take the BO Mapper settings and change them if that is the fix but my concern is then that the SF DateBox controls will then have an issue. What do you suggest as an alternative to have null dates show up as null or blank in grids rather than 01/01/1800?
Ross L. Rooker, Sr.
Ross L. Rooker, Sr.
StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)
Group: Forum Members
Posts: 153, Visits: 462
In our BO Mapper we set the Datetime as follows:

NULL VALUE OPTION:  Return Alternate on Null / Set Null on Alternate(value)

NULL REPLACEMENT VALUE: new DateTime(1800, 1, 1)

This works great in the SF Date controls at times in that 01/01/1800 is NOT wriitten back to the database when using the SF control.

Here is my issue: I have an Infragistics grid bound to a BO. In the grid the date always shows 01/01/1800 when the value in the table for a date is NULL. My thoughts are that the BO is returning 01/01/1800 even if the date in null.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search