473,320 Members | 1,988 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,320 software developers and data experts.

Calendar Control PRoblem

Laz
I need some assistance.

I am getting the error "Conversion from type 'DBNull' to type 'Date' is
not valid." while rendering the edit template column of a calendar
control where the SQL field is null.

Here is the column code:
<ASP:TemplateColumn HEADERTEXT="Planned Date"
ITEMSTYLE-HORIZONTALALIGN="Center">
<ItemTemplate>
<%# String.Format("{0:d}", DataBinder.Eval
(Container.DataItem, "WISP_Upgrade_Planned_Date")) %>
</ItemTemplate>
<EditItemTemplate>
<ASP:Calendar ID="plannedDate" RUNAT="Server"
SelectedDate='<%# CheckDate(DataBinder.Eval
(Container.DataItem, "WISP_Upgrade_Planned_Date")) %>'
VisibleDate='<%# CheckDate(DataBinder.Eval
(Container.DataItem, "WISP_Upgrade_Planned_Date")) %>'/>
</EditItemTemplate>
</ASP:TemplateColumn>

As you can see, I tried creating a function that supplies a date value
of Now() if the column is null.

Function CheckDate(SelectedDate As DateTime)
If IsDBNull(SelectedDate) Then
Return Now()
Else
Return SelectedDate
End If
End Function

But IIS never gets to even try the function as the error happens BEFORE
the function is executed.
Please advise.

Thanks

Aug 29 '06 #1
0 988

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

Similar topics

16
by: DFS | last post by:
If you're listening, I want the middle of the calendar (showing 1 month) to open below the cursor position. It currently opens just to the right and below the cursor position. I hunted through...
7
by: Colin Young | last post by:
I have a UserControl that contains a calendar control. The calendar is not raising events (month navigation, date selections, etc.). I've checked that the OnSelectionChanged event has a handler...
1
by: slawek xxxxx | last post by:
Hello everyone, I have a terrible with Calendar control and I hope someone of you can help me. The problem is following. I have to display a calendar to select date. I have prepared page with...
5
by: Miguel Dias Moura | last post by:
Hello, i am trying to create a .css file with several styles and apply them to the calendar control so i can change the look of: 1. Text Type and Format (Bold, Underline, etc) 2. Background...
0
by: maxrawson | last post by:
First, let me start by saying my asp.net experience is still in it's infancy so please bare with me as I try to explain my situation. I have created a single page that with the use of many...
2
by: Caesar Augustus | last post by:
First, let me start by saying my asp.net experience is still in it's infancy so please bare with me as I try to explain my situation. I have created a single page that with the use of many...
0
by: Robert Ladd | last post by:
Hi, I'm trying to disable the asp.net calendar control from a javascript function, but it doesn't disable the doPostBack. To simplify the situation, assume a page with 4 controls. A...
3
by: =?Utf-8?B?UGFycm90?= | last post by:
I applied the following Ajax code in my web page which has a calendar control to keep my page from completely reloading everytime something was changed. <atlas:ScriptManager ID="ScriptManager1"...
3
by: thorpk | last post by:
I posted this problem earlier in the month and some one decided it was better to change the subject and ask a completely different question. I am therefore reposting. I am hoping some one can...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.