andycharger
Centurion
- Joined
- Apr 2, 2003
- Messages
- 152
Can somone PLEASE help!
I have a datalist that is populated from a SQL statement when my page loads.
However, I have 2 date fields in my SQL database and only 1 will ever be populated.
So when my page loads and date1 is populated, my page falls over when it tries to databind date2 to a cell in my table and vice versa!
i.e.
I have to convert to a ToShortDateString otherwise my date comes out in a long format.
Is there a way to ignore binding the date if its DB null or a way to get the page to ignore DBNulls?
Any help would be appreciated!
Andy
I have a datalist that is populated from a SQL statement when my page loads.
However, I have 2 date fields in my SQL database and only 1 will ever be populated.
So when my page loads and date1 is populated, my page falls over when it tries to databind date2 to a cell in my table and vice versa!
i.e.
Visual Basic:
<%# DataBinder.Eval(Container.DataItem, "date1").ToShortDateString() %>
I have to convert to a ToShortDateString otherwise my date comes out in a long format.
Is there a way to ignore binding the date if its DB null or a way to get the page to ignore DBNulls?
Any help would be appreciated!
Andy