DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Fri, 17 Aug 2007 10:34:29 -0500,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Craig Buchanan
          2    Braulio Diez


Calendar control and Null dates issue   
I have embedded an asp:Calendar control into the EditItemTemplate of 
GridView column.  I have set the SelectedDate='<%# Bind("Finished") %>' 
VisibleDate='<%# Eval("Finished") %>', to the AccessDataSource's 'Finished' 
column (a Date type).

The control correctly binds to the column if the date isn't null.  If the 
column is null, I get an error that reads:

Conversion from type 'DBNull' to type 'Date' is not valid.

What am I missing here?  Is there an easy fix?

Thanks,

Craig Buchanan
Date:Fri, 17 Aug 2007 10:34:29 -0500   Author:  

RE: Calendar control and Null dates issue   
Here you have an article that explains how to avoid this in PreRender:

http://www.c-sharpcorner.com/UploadFile/sd_patel/ASPNetCalendarControl11222005054337AM/ASPNetCalendarControl.aspx

Some other guys tell to extend the calendar control in order to handle null 
values in the get/set property of the calendar control:

http://forums.asp.net/p/1046084/1468000.aspx

HTH
  Braulio


/// ------------------------------
/// Braulio Diez
///
/// http://www.tipsdotnet.com
/// ------------------------------




"Craig Buchanan" wrote:


> I have embedded an asp:Calendar control into the EditItemTemplate of 
> GridView column.  I have set the SelectedDate='<%# Bind("Finished") %>' 
> VisibleDate='<%# Eval("Finished") %>', to the AccessDataSource's 'Finished' 
> column (a Date type).
> 
> The control correctly binds to the column if the date isn't null.  If the 
> column is null, I get an error that reads:
> 
> Conversion from type 'DBNull' to type 'Date' is not valid.
> 
> What am I missing here?  Is there an easy fix?
> 
> Thanks,
> 
> Craig Buchanan 
> 
> 
> 
Date:Fri, 17 Aug 2007 15:40:02 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us