troubleshooting Question

Calendar control throws error when NULL value is databound to selected date.

Avatar of Danik_S
Danik_S asked on
.NET ProgrammingASP.NETVisual Basic.NET
4 Comments1 Solution375 ViewsLast Modified:
Hi

I have a calendar control (calDateGiven) in the editItemTemplate of a gridview which has its visible and selected date properties bound.  Each record may or may not have had a date entered previously.  If a date has not previously been selected then the DateGiven field in the database will contain NULL.  

When the data is bound to the calendar control it throws an error if the database value is NULL because it can't be converted to a date for binding the selected and visible date properties of the calendar.  Fair enough.  So I figured that I need to use the databinding event of the calendar control to check if the recordset value that's about to be bound to the control is NULL and if it is, avoid binding the calendar's propreties.  How do I do this?  Specifically, how do I access the DateGiven value that is about to be bound to the control?

Any help much appreciated.

Cheers,
Danik
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros