Hi All
Im new to asp.net. Im looking to hide rows in a table in a formview InsertItemTemplate depending on a bit value in a MS SQL table. I have it working in the EditItemTemplate. Im also using VB coding.
<tr runat="server" visible='<%# eval("shirtsv") %>'>
my formview code is as follows
<asp:FormView ID="FormView1" runat="server" DataKeyNames="AID"
DataSourceID="InsertEditConfirm">
<EditItemTemplate>
<table style="width:100%;">
<tr>
<td align="right" width="190">
Attending :
</td>
<td width="10">
</td>
<td align="left" width="400">
<asp:DropDownList ID="DropDownList4" runat="server" Font-Names="Verdana"
Font-Size="10px" SelectedValue='<%# Bind("Attending") %>' Width="205px">
<asp:ListItem Selected="True">-</asp:ListItem>
<asp:ListItem>Yes</asp:ListItem>
<asp:ListItem>No</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr runat="server" visible='<%# eval("shirtsv") %>'>
<td align="right" width="190">
Shirt Size :
</td>
<td width="10">
</td>
<td align="left" width="400">
<asp:DropDownList ID="DropDownList5" runat="server" Font-Names="Verdana"
Font-Size="10px" SelectedValue='<%# Bind("ShirtSize") %>' Width="205px">
<asp:ListItem Selected="True">-</asp:ListItem>
<asp:ListItem>S</asp:ListItem>
<asp:ListItem>M</asp:ListItem>
<asp:ListItem>L</asp:ListItem>
<asp:ListItem>XL</asp:ListItem>
<asp:ListItem>XXL</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td align="right" width="190">
Handy Cap :
</td>
<td width="10">
</td>
<td align="left" width="400">
<asp:TextBox ID="HandyCapTextBox" runat="server" BorderStyle="Solid"
BorderWidth="1px" Font-Names="Verdana" Font-Size="10px"
Text='<%# Bind("HandyCap") %>' Width="200px" />
</td>
</tr>
<tr>
<td align="right" width="190">
Attending Prize Giving :
</td>
<td width="10">
</td>
<td align="left" width="400">
<asp:DropDownList ID="DropDownList6" runat="server" Font-Names="Verdana"
Font-Size="10px" SelectedValue='<%# Bind("PrizeGiving") %>' Width="205px">
<asp:ListItem Selected="True">-</asp:ListItem>
<asp:ListItem>Yes</asp:ListItem>
<asp:ListItem>No</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td align="right" width="190">
Partners Name :
</td>
<td width="10">
</td>
<td align="left" width="400">
<asp:TextBox ID="PartnerNameTextBox" runat="server" BorderStyle="Solid"
BorderWidth="1px" Font-Names="Verdana" Font-Size="10px"
Text='<%# Bind("PartnerName") %>' Width="200px" />
</td>
</tr>
<tr>
<td width="190">
</td>
<td width="10">
</td>
<td width="400">
</td>
</tr>
<tr>
<td width="190">
</td>
<td width="10">
</td>
<td align="left" width="400">
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True"
CommandName="Update" Text="Update" />
<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False"
CommandName="Cancel" Text="Cancel" />
<asp:LinkButton ID="UpdateCancelButton0" runat="server"
CausesValidation="False" CommandName="Insert" Text="Insert" />
</td>
</tr>
</table>
<asp:Label ID="AIDLabel1" runat="server" Text='<%# Eval("AID") %>'
Visible="False" />
<br />
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="GetEventDetails" DataTextField="EID" DataValueField="EID"
SelectedValue='<%# Bind("EID") %>' Visible="False">
</asp:DropDownList>
<asp:DropDownList ID="DropDownList2" runat="server"
DataSourceID="GetClientDetails" DataTextField="CID" DataValueField="CID"
SelectedValue='<%# Bind("CID") %>' Visible="False">
</asp:DropDownList>
<asp:DropDownList ID="DropDownList3" runat="server"
DataSourceID="GetClientDetails" DataTextField="Email" DataValueField="Email"
SelectedValue='<%# Bind("CEmail") %>' Visible="False">
</asp:DropDownList>
<br />
</EditItemTemplate>
<InsertItemTemplate>
<table style="width:100%;">
<tr>
<td align="right" width="190">
Attending :
</td>
<td width="10">
</td>
<td align="left" width="400">
<asp:DropDownList ID="DropDownList9" runat="server" Font-Names="Verdana"
Font-Size="10px" SelectedValue='<%# Bind("Attending") %>' Width="205px">
<asp:ListItem Selected="True">-</asp:ListItem>
<asp:ListItem>Yes</asp:ListItem>
<asp:ListItem>No</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td align="right" width="190">
Partner Name :
</td>
<td width="10">
</td>
<td align="left">
<asp:TextBox ID="PartnerNameTextBox" runat="server" BorderStyle="Solid"
BorderWidth="1px" Font-Names="Verdana" Font-Size="10px"
Text='<%# Bind("PartnerName") %>' Width="200px" />
</td>
</tr>
<tr>
<td align="right" width="190">
Shirt Size :
</td>
<td width="10">
</td>
<td align="left" width="400">
<asp:DropDownList ID="DropDownList10" runat="server" Font-Names="Verdana"
Font-Size="10px" SelectedValue='<%# Bind("ShirtSize") %>' Width="205px">
<asp:ListItem Selected="True">-</asp:ListItem>
<asp:ListItem>S</asp:ListItem>
<asp:ListItem>M</asp:ListItem>
<asp:ListItem>L</asp:ListItem>
<asp:ListItem>XL</asp:ListItem>
<asp:ListItem>XXL</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td align="right" width="190">
Handy Cap :
</td>
<td width="10">
</td>
<td align="left" width="400">
<asp:TextBox ID="HandyCapTextBox" runat="server" BorderStyle="Solid"
BorderWidth="1px" Font-Names="Verdana" Font-Size="10px"
Text='<%# Bind("HandyCap") %>' Width="200px" />
</td>
</tr>
<tr>
<td align="right" width="190">
Attending Prize Giving :
</td>
<td width="10">
</td>
<td align="left" valign="top" width="400">
<asp:DropDownList ID="DropDownList11" runat="server" Font-Names="Verdana"
Font-Size="10px" SelectedValue='<%# Bind("PrizeGiving") %>' Width="205px">
<asp:ListItem Selected="True">-</asp:ListItem>
<asp:ListItem>Yes</asp:ListItem>
<asp:ListItem>No</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td align="right" width="190">
</td>
<td width="10">
</td>
<td align="left" width="400">
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True"
CommandName="Insert" Text="Insert" />
<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False"
CommandName="Cancel" Text="Cancel" />
</td>
</tr>
<tr>
<td align="right" width="190">
</td>
<td width="10">
</td>
<td align="left" width="400">
</td>
</tr>
</table>
<br />
<asp:DropDownList ID="DropDownList8" runat="server"
DataSourceID="GetClientDetails" DataTextField="CID" DataValueField="CID"
SelectedValue='<%# Bind("CID") %>' Visible="False">
</asp:DropDownList>
<asp:DropDownList ID="DropDownList7" runat="server"
DataSourceID="GetEventDetails" DataTextField="EID" DataValueField="EID"
SelectedValue='<%# Bind("EID") %>' Visible="False">
</asp:DropDownList>
<asp:DropDownList ID="DropDownList12" runat="server"
DataSourceID="GetClientDetails" DataTextField="Email" DataValueField="Email"
SelectedValue='<%# Bind("CEmail") %>' Visible="False">
</asp:DropDownList>
</InsertItemTemplate>
</asp:FormView>
and the following Sqldata sourse for it
<asp:SqlDataSource ID="InsertEditConfirm" runat="server" ConnectionString="<%$ ConnectionStrings:EventRegConnString %>"
DeleteCommand="DELETE FROM [HA_Confirm] WHERE [AID] = @AID" InsertCommand="INSERT INTO [HA_Confirm] ([EID], [CID], [Attending], [PartnerName], [ShirtSize], [HandyCap], [PrizeGiving], [CEmail]) VALUES (@EID, @CID, @Attending, @PartnerName, @ShirtSize, @HandyCap, @PrizeGiving, @CEmail)"
SelectCommand="SELECT HA_Confirm.AID, HA_Confirm.EID, HA_Confirm.CID, HA_Confirm.Attending, HA_Confirm.PartnerName, HA_Confirm.ShirtSize, HA_Confirm.HandyCap, HA_Confirm.PrizeGiving, HA_Confirm.CEmail, HA_Events.Shirtsv FROM HA_Confirm INNER JOIN HA_Events ON HA_Confirm.EID = HA_Events.EID WHERE (HA_Confirm.EID = @EID) AND (HA_Confirm.CEmail = @CEmail)"
UpdateCommand="UPDATE [HA_Confirm] SET [EID] = @EID, [CID] = @CID, [Attending] = @Attending, [PartnerName] = @PartnerName, [ShirtSize] = @ShirtSize, [HandyCap] = @HandyCap, [PrizeGiving] = @PrizeGiving, [CEmail] = @CEmail WHERE [AID] = @AID">
<SelectParameters>
<asp:QueryStringParameter Name="EID" QueryStringField="EID" Type="Int32" />
<asp:QueryStringParameter Name="CEmail" QueryStringField="EM" Type="String" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="AID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="EID" Type="Int32" />
<asp:Parameter Name="CID" Type="Int32" />
<asp:Parameter Name="Attending" Type="String" />
<asp:Parameter Name="PartnerName" Type="String" />
<asp:Parameter Name="ShirtSize" Type="String" />
<asp:Parameter Name="HandyCap" Type="String" />
<asp:Parameter Name="PrizeGiving" Type="String" />
<asp:Parameter Name="CEmail" Type="String" />
<asp:Parameter Name="AID" Type="Int32" />
<asp:Parameter Name="Shirtsv" Type="Boolean" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="EID" Type="Int32" />
<asp:Parameter Name="CID" Type="Int32" />
<asp:Parameter Name="Attending" Type="String" />
<asp:Parameter Name="PartnerName" Type="String" />
<asp:Parameter Name="ShirtSize" Type="String" />
<asp:Parameter Name="HandyCap" Type="String" />
<asp:Parameter Name="PrizeGiving" Type="String" />
<asp:Parameter Name="CEmail" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
Kind Regards
Marcel