I have a ListView control which has an InsertItemTemplate definition (ListView has rows containing tabular data and then one row with a drop-down and 2 checkboxes allows adding of new data). InsertItemTemplate tag is as follows;
My question is: how do I reference the drop-down list (cboDayTours) and the 2 checkboxes (chkDayMbr1 and chkDayMbr2) in the code file? The ListView is used to show particular tours that a member has been on and the checkboxes indicate whether it was just the member, or the member and their spouse who went on the tour. If the particular member does not have a spouse/partner, I want to disable the chkDayMbr2 checkbox but I can't work out how to do this.
Since these controls above are defined in a ListView InsertItemTemplate tag, the controls cannot be referenced directly from the code page. I've tried defining the controls on the code page as well using;
but the link is not made between the object on the code page and the control on the web form.
Any assistance would be greatly appreciated!
VB.NET:
<InsertItemTemplate>
<tr runat="server">
<td colspan="2">
<asp:DropDownList ID="cboDayTours" DataSourceID="adsDayToursList" DataTextField="TourDetail" DataValueField="TourID" runat="server"></asp:DropDownList>
</td>
<td style="text-align:center;"><asp:checkbox id="chkDayMbr1" runat="server" /></td>
<td style="text-align:center;"><asp:checkbox id="chkDayMbr2" runat="server" /></td>
<td style="text-align:center;"><asp:Button ID="cmdAddDayTour" OnClick="AddTour_Click" Text="Add" Width="40" CssClass="stdbutton" CausesValidation="true" CommandName="day" runat="server" /></td>
</tr>
</InsertItemTemplate>
My question is: how do I reference the drop-down list (cboDayTours) and the 2 checkboxes (chkDayMbr1 and chkDayMbr2) in the code file? The ListView is used to show particular tours that a member has been on and the checkboxes indicate whether it was just the member, or the member and their spouse who went on the tour. If the particular member does not have a spouse/partner, I want to disable the chkDayMbr2 checkbox but I can't work out how to do this.
Since these controls above are defined in a ListView InsertItemTemplate tag, the controls cannot be referenced directly from the code page. I've tried defining the controls on the code page as well using;
VB.NET:
Protected WithEvents chkDayMbr1 as checkbox
but the link is not made between the object on the code page and the control on the web form.
Any assistance would be greatly appreciated!