C
Cirene
I cannot reference a calendar control in my formview control. (I want the
calendar's date to be set to "Today" whenever they enter insert mode.)
Here's part of the formview...
<asp:FormView ID="FormView1" runat="server" CellPadding="4"
DataKeyNames="ListingId"
DataSourceID="sdsListingDetails" ForeColor="#333333">
:
:
<InsertItemTemplate><table cellpadding="0" cellspacing="0"
width="700">
:
:
<tr>
<td style="width: 166px" valign="top">
Bid Deadline:</td>
<td>
<asp:Calendar ID="calDeadline" runat="server"
Height="165px" SelectedDate='<%# Bind("LBidDeadline") %>'
Width="259px"></asp:Calendar>
</td>
</tr>
:
:
</InsertItemTemplate>
:
:
</asp:FormView>
Here's the code:
Protected Sub FormView1_ModeChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles FormView1.ModeChanged
Select Case Me.FormView1.CurrentMode
Case FormViewMode.Insert
Dim cal As Calendar =
CType(Me.FormView1.FindControl("calDeadline"), Calendar)
cal.SelectedDate = Now.Date
End Select
End Sub
The variable 'cal' is "Nothing" everytime I set it! In fact, I cannot
reference any textboxes in the formview as well.
I know it's probably something simple.
Any ideas?
calendar's date to be set to "Today" whenever they enter insert mode.)
Here's part of the formview...
<asp:FormView ID="FormView1" runat="server" CellPadding="4"
DataKeyNames="ListingId"
DataSourceID="sdsListingDetails" ForeColor="#333333">
:
:
<InsertItemTemplate><table cellpadding="0" cellspacing="0"
width="700">
:
:
<tr>
<td style="width: 166px" valign="top">
Bid Deadline:</td>
<td>
<asp:Calendar ID="calDeadline" runat="server"
Height="165px" SelectedDate='<%# Bind("LBidDeadline") %>'
Width="259px"></asp:Calendar>
</td>
</tr>
:
:
</InsertItemTemplate>
:
:
</asp:FormView>
Here's the code:
Protected Sub FormView1_ModeChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles FormView1.ModeChanged
Select Case Me.FormView1.CurrentMode
Case FormViewMode.Insert
Dim cal As Calendar =
CType(Me.FormView1.FindControl("calDeadline"), Calendar)
cal.SelectedDate = Now.Date
End Select
End Sub
The variable 'cal' is "Nothing" everytime I set it! In fact, I cannot
reference any textboxes in the formview as well.
I know it's probably something simple.
Any ideas?