473,406 Members | 2,705 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,406 software developers and data experts.

display empty datetime as blank?

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!
Mar 27 '06 #1
3 3323
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?
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Dabbler" wrote:
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!

Mar 27 '06 #2

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.
"Phillip Williams" wrote:
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?
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Dabbler" wrote:
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!

Mar 27 '06 #3
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/

Mar 28 '06 #4

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

Similar topics

23
by: Mat | last post by:
<div id="container"> <div id="main"> <div id="header"> <p class="Address">123 Fake Street, </p> <p class="City">Crazy City, </p> <p class="Province">Ontario </p> <p class="PostalCode">H0H...
4
by: Carlos Lozano | last post by:
Hello Folks! I have a grid that populates from a table on SQL Server. All datetime with DBNull value show 1/1/1900 12:00AM ... Instead of just blank (""). I found a document with the following...
3
by: Andrew S. Giles | last post by:
Hello, I am importing a flat text file, and putting it into a datagrid for display on a form. Currently the users have their dates and times seperated. I have two fields, therefore in the...
1
by: Thierry | last post by:
Hi, I've got the next problem: I have a datetime field in my database (sql-server) and I want the option in it that this field can be empty. But if I leave that datetime field empty I get...
2
by: bb | last post by:
any way to prevent displaying the previous and next months in the calendar control? i have tried just blanking the text out in the dayrender IsOtherMonth and also dynamically changing the...
4
by: Fraggle | last post by:
Hi, I want to validate a text box, The user can leave it blank, or fill it in. If they fill it in then it must be a date within a certain range. How can I achieve this? Thank you very much
2
by: GossTremontTech | last post by:
Hi, We have a webservice that generates an xml string that has a empty/null datetime field (<OurDate></Ourdate>). When we use ReadXML read in the serialized string we get the error: "string...
1
by: Brad Pears | last post by:
I am using vb.net 2005 and SQL server 2000. In my table I have a date field of type "smalldatetime". In my vb application, the user may or may not enter a date value into the appropriate text box....
3
by: JCCDEVEL | last post by:
Hello, I'm writing a basic query in Sql Server Mgmt Studio 2005. Basically, I'm trying to query a table to get all "issues" reported in a month by "Project Category". The query is working fine...
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: 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: 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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.