473,378 Members | 1,496 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Presenting a Blank DateTime to User / n-Tier

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
Nov 21 '05 #1
3 1223
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?

"Raterus" wrote:
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

Nov 21 '05 #2
I found the answer, if you are still looking.. email me..

"Raterus" wrote:
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

Nov 21 '05 #3
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

"Mathew Michuta" wrote:
I found the answer, if you are still looking.. email me..

"Raterus" wrote:
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

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Barry | last post by:
Hi all, I'd like to implement a Gaelic tutorial with the inclusion of Gaelic fonts. Irish Gaelic has 18 letters - abcdefghilmnoprstu but vowels can also take an acute accent, called a fada...
15
by: Dan S | last post by:
My application asks the user to enter in a date - in the mm/dd/yyyy format. Is there any quick and easy way to verify the date the user enters is formatted correctly? Right now I'm calling...
12
by: Vicky | last post by:
What is the better way of checking blank string is it strvar.lenght > 0 or strvar == "" or something else Thnaks
6
by: Johann Blake | last post by:
I fill a table in a dataset with values that will be used by a combobox for the combobox's items. The combobox is a drop down list that only allows the user to select from the list but not enter...
2
by: Tronex | last post by:
Hi there, I am desperate and need help on this from someone who actually knows what he does... cuz I certainly don't ;-) This is the situation: I have an ASP.NET web application (written in...
2
by: Boonaap | last post by:
Hi all, In a user control, the user can put the cultureinfo to his preference, choosing between "nl-BE","fr-BE", and "en-US". this way all calendar and datetime properties are set in the right...
38
by: nobody | last post by:
I know that given a FormatString and a DateTime you can use DateTime.ToString(...) to convert the DateTime to a String. My question is how can you turn that around? Given a String and a...
3
by: Dabbler | last post by:
How do I display a datetime field that hasn't been assigned a value as blank instead of the default minimum value? I need to do this in both display and edit modes. Thanks!
2
by: rsdev | last post by:
Hi, I have a stored procedure which is returning a blank id. Here's my code; SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings); SqlCommand cmd = new...
5
by: indika | last post by:
Hi, I'm a newbie to python but have some experience in programming. I came across this requirement of using datetime.date objects associated with some another object. eg. a dictionary containing...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.