我试图根据我的会话变量的当前状态隐藏我的表单视图的单行。
目前我正在尝试将行包含在更新面板中,然后简单地将 Visible 属性设置为 true 或 false。
这目前不起作用。
这是代码:
<asp:FormView ID="FormView1" runat="server" Height="51px" Width="387px">
<EditItemTemplate>
coffeeName:
<asp:TextBox ID="coffeeNameTextBox" runat="server"
Text='<%# Bind("coffeeName") %>' />
<br />
coffeeOrigin:
<asp:TextBox ID="coffeeOriginTextBox" runat="server"
Text='<%# Bind("coffeeOrigin") %>' />
<br />
coffeeStrength:
<asp:TextBox ID="coffeeStrengthTextBox" runat="server"
Text='<%# Bind("coffeeStrength") %>' />
<br />
coffeePrice:
<asp:TextBox ID="coffeePriceTextBox" runat="server"
Text='<%# Bind("coffeePrice") %>' />
<br />
coffeeGrind:
<asp:TextBox ID="coffeeGrindTextBox" runat="server"
Text='<%# Bind("coffeeGrind") %>' />
<br />
coffeeQty:
<asp:TextBox ID="coffeeQtyTextBox" runat="server"
Text='<%# Bind("coffeeQty") %>' />
<br />
coffeeRRP:
<asp:TextBox ID="coffeeRRPTextBox" runat="server"
Text='<%# Bind("coffeeRRP") %>' />
<br />
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True"
CommandName="Update" Text="Update" />
<asp:LinkButton ID="UpdateCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</EditItemTemplate>
<ItemTemplate>
<b>Origin:</b>
<asp:Label ID="coffeeOriginLabel" runat="server"
Text='<%# Bind("coffeeOrigin") %>' />
<br />
<br />
<b>Grind:</b>
<asp:Label ID="coffeeGrindLabel" runat="server"
Text='<%# Bind("coffeeGrind") %>' />
<br />
<br />
<b>Strength:</b>
<asp:Label ID="coffeeStrengthLabel" runat="server"
Text='<%# Bind("coffeeStrength") %>' />
<br />
<br />
<b>Price: £</b>
<asp:Label ID="coffeePriceLabel" runat="server"
Text='<%# Bind("coffeePrice") %>' />
<br />
<br />
********** Panel used to enclose the stock level**********
<asp:Panel ID="panelLevel" runat="server">
<b>Stock Level:</b>
<asp:Label ID="coffeeQtyLabel" runat="server" Text='<%# Bind("coffeeQty") %>' />
<br />
<br />
<br />
</asp:Panel>
</ItemTemplate>
</asp:FormView>
我想达到什么目的。
当前表单视图:
将面板可见性设置为 false 应该会产生以下输出: