display empty datetime as blank?

G

Guest

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!
 
G

Guest

I do not get a minimum date if I save a null in a date field. I get back
null. Are you databinding your controls from a Business Logic Layer or from
a data layer?
 
G

Guest

Hi Phillip,

right now I'm binding to a SqlDataSource but at some point I will be using
ObjectDataSource too. I have inserted about 1,700 rows using SQL Manager 2005
import tool without a value mapped to that particular datetome field so I
presume SQL 2005 would leave the datetime field null. I guess the question is
what event do I intercept to set the textbox text property value to blank
instead of the default 01/01/0001.

Thanks.
 
Q

q

You have many options... if you are binding you can override what is
being bound.

You can also make a new property like


public string FormattedDate {
get { return (this.Date == null) ? "" : this.Date; }
}

or whatever.

You could also do this in your own business object (for use with the
object data source) or you could do the processing in SQL.

David Betz
WinFX Harmonics Blog
http://www.davidbetz.net/winfx/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top