Presenting a Blank DateTime to User / n-Tier

  • Thread starter Thread starter Raterus
  • Start date Start date
R

Raterus

Hi,

I have a business object that exposes a DateTime object to my presentation layer. Usually this is filled with a valid date, but sometimes it is empty (and stored as 1/1/1900 as it is a SmallDateTime in SQL Server). I'm unsure how best to present this to the user, I want no date to appear if it is blank "1/1/1900", but if it is a valid date, show it.

I guess I'm a little confused as to which layer should do this, my first hunch is the presentation layer, since this deals with what the user sees, but then when I think about it, to do this correctly, the presentation layer would have to account for the 1/1/1900 problem, which seems like something the business layer should have to do.

Is there any way I can store a value in a DateTime object, so when I use a ToString method, it returns as "", that would really fix it! Or any other suggestions I might try?

Thanks,
--Michael
 
Sorry, don't have an answer. Just the same question

I want to do the same thing, except inside a datagrid. I know you can change
the sql select string to accomplish this, but my data table has many, many
dates, and the sql select string will be huge.

Is there any way to use the DataGridTextBoxColumn.Format function to
accomplish showing a blank date in the datagrid?
 
Hi Mathew, (or Micheal)

We are facing the same problem -- how to show a blank date to the user .
Ours is an n'tier application, In our db we store the date as null, but we
are not able to set the value of a date attribute to null..

If you do have a resolution, please respond . We have the isssue in our form
fields.

thanks a lot

Anand
 
Back
Top