C
Cal Who
In Design mode the code below shows:
Error rendering control - dp1
An unhandled exception has occurred.
Object reference not set for an instance of an object.
Likewise for tp1, dp2 and tp2
The code appears to work OK but I would like to remove those notices when I
look at it.
Any suggestions?
Thanks
<%@ Control Language="VB" AutoEventWireup="false"
CodeFile="DurationSelecter.ascx.vb" Inherits="Calendar_DurationSelecter" %>
<%@ Register TagPrefix="MyLib" Namespace="My.Library" %>
<script runat="server">
Public Property startDateTime() As Date
Get
Return dp1.SelectedDate.Add(tp1.SelectedTime.TimeOfDay)
End Get
Set(ByVal value As Date)
dp1.SelectedDate = value
tp1.SelectedTime = value
End Set
End Property
Public Property endDateTime() As Date
Get
Return dp2.SelectedDate.Add(tp2.SelectedTime.TimeOfDay)
End Get
Set(ByVal value As Date)
dp2.SelectedDate = value
tp2.SelectedTime = value
End Set
End Property
</script>
<table>
<tr>
<td align="center" colspan="2">
Start Date and Time:
</td>
<td align="center" colspan="2">
End Date and Time:
</td>
</tr>
<tr>
<td>
<MyLibatePicker ID="dp1" runat="server" />
</td>
<td>
<MyLib:TimePicker ID="tp1" runat="server" />
</td>
<td>
<MyLibatePicker ID="dp2" runat="server" />
</td>
<td>
<MyLib:TimePicker ID="tp2" runat="server" />
</td>
</tr>
</table>
the .vb file contains only:
Partial Class Calendar_DurationSelecter
Inherits System.Web.UI.UserControl
End Class
Error rendering control - dp1
An unhandled exception has occurred.
Object reference not set for an instance of an object.
Likewise for tp1, dp2 and tp2
The code appears to work OK but I would like to remove those notices when I
look at it.
Any suggestions?
Thanks
<%@ Control Language="VB" AutoEventWireup="false"
CodeFile="DurationSelecter.ascx.vb" Inherits="Calendar_DurationSelecter" %>
<%@ Register TagPrefix="MyLib" Namespace="My.Library" %>
<script runat="server">
Public Property startDateTime() As Date
Get
Return dp1.SelectedDate.Add(tp1.SelectedTime.TimeOfDay)
End Get
Set(ByVal value As Date)
dp1.SelectedDate = value
tp1.SelectedTime = value
End Set
End Property
Public Property endDateTime() As Date
Get
Return dp2.SelectedDate.Add(tp2.SelectedTime.TimeOfDay)
End Get
Set(ByVal value As Date)
dp2.SelectedDate = value
tp2.SelectedTime = value
End Set
End Property
</script>
<table>
<tr>
<td align="center" colspan="2">
Start Date and Time:
</td>
<td align="center" colspan="2">
End Date and Time:
</td>
</tr>
<tr>
<td>
<MyLibatePicker ID="dp1" runat="server" />
</td>
<td>
<MyLib:TimePicker ID="tp1" runat="server" />
</td>
<td>
<MyLibatePicker ID="dp2" runat="server" />
</td>
<td>
<MyLib:TimePicker ID="tp2" runat="server" />
</td>
</tr>
</table>
the .vb file contains only:
Partial Class Calendar_DurationSelecter
Inherits System.Web.UI.UserControl
End Class