SqlDataSource ControlParameter Cannot Find Control
I am using asp:TemplateField instead of asp:BoundField. I have coded a TextBox inside a DetailsView. I then coded a SqlDataSource asp:ControlParameter and the ControlParameter cannot find the TextBox. Is this another case of needing FindControl? Below is the pertinent code, minus the validators.
<asp:DetailsView ID="SchedulingDetailsView" runat="server"
BorderWidth="0px"
DataSourceID="SqlTrips"
DataKeyNames="Id"
OnItemInserted="SchedulingDetailsView_ItemInserted "
AutoGenerateRows="false"
AutoGenerateInsertButton="true"
DefaultMode="Insert"
CssClass="SchedulingDetailsView"
CommandRowStyle-CssClass="SchedulingDetailsViewCommandStyle">
<Fields>
<asp:TemplateField>
<HeaderTemplate>
<asp:Label ID="lblDepartureDate" runat="server"
CssClass="SchedulingDetailsViewHeader"
Text="Departure Date:">
</asp:Label>
</HeaderTemplate>
<InsertItemTemplate>
<asp:TextBox ID="tbDepartureDate" runnat="server"
CssClass="SchedulingDetailsViewItem">
</asp:TextBox>
</InsertItemTemplate>
</asp:TemplateField>
</Fields>
</asp:DetailsView>
<asp:SqlDataSource ID="SqlTrips" runat="server"
ConnectionString="<%$ ConnectionStrings:fireConnection %>"
InsertCommand="INSERT INTO [fireTrips] ([DepartureDate],[ReturnDate],[DestinationCity],[DestinationCountry],[TripDescription],[Cost],[TripStatus],[Availability]) VALUES (@DepartureDate, @ReturnDate, @DestinationCity, @DestinationCountry, @TripDescription, @Cost, @TripStatus, @Availability)"
InsertCommandType="Text">
<InsertParameters>
<asp:ControlParameter ControlID="tbDepartureDate" Name="DepartureDate" Type="DateTime" />
</InsertParameters>
</asp:SqlDataSource>
How do I access the controls inside the DetailsView from the ControlParameter.
Thanks in advance for any help given.
|