C# 在asp.net中隐藏内容
有没有一种方法可以隐藏asp.net中的一段代码,使其仅在出现问题时才可见 我有这个,但不起作用C# 在asp.net中隐藏内容,c#,asp.net,C#,Asp.net,有没有一种方法可以隐藏asp.net中的一段代码,使其仅在出现问题时才可见 我有这个,但不起作用 <asp:DropDownList ID="drop" runat="server" Width="100" Height="25" BackColor="#CEECF5" CssClass="Selection"> <asp:ListItem Text="Rock" Value="1" /> <asp:ListItem Text="Paper" Value
<asp:DropDownList ID="drop" runat="server" Width="100" Height="25" BackColor="#CEECF5" CssClass="Selection">
<asp:ListItem Text="Rock" Value="1" />
<asp:ListItem Text="Paper" Value="2" />
<asp:ListItem Text="Scissor" Value="3" />
<asp:ListItem Text="Lizard" Value="4" />
<asp:ListItem Text="Spock" Value="5" />
</asp:DropDownList>
<asp:Button Text="Play Hand" ID ="play" runat="server" BackColor="WhiteSmoke" Width="100" Height="25" CssClass="Button"/>
<asp:View ID="GameResults" ViewStateMode="Disabled">
<br />
<table>
<tr>
<td><asp:Image ID="PlayedHand" runat="server" /></td>
<td><asp:Image ID="RandomHand" runat="Server" /></td>
</tr>
<tr>
<td><asp:Label ID="PlayedLabel" Text="You played ....." runat="server" /></td>
<td><asp:Label ID="RandomLabel" Text="Opponent played ....." runat="server" /></td>
</tr>
</table>
</asp:View>
我正在寻找一种方法,使结果只出现在按下按钮,游戏进行评估
我知道我可以处理单个元素,但这对HTML表标记没有帮助。所以我更喜欢将整个对象封装起来
有没有办法隐藏整个内容块 在GameResults视图中,将所有内容包装在一个div中:
<div id="divResults" runat="server" hidden="true">
将所有内容包装在ASP:Literal控件中,然后将其visible属性设置为false。这不起作用。当我尝试时,我得到了“'System.Web.UI.WebControls.Literal'不允许子控件。”啊,是的,你有图像和标签。对不起,我没看到。
If (game is evaluated) then divResults.hidden= false