【发布时间】:2011-12-26 04:24:59
【问题描述】:
我在表格单元中放置了一个面板并将宽度和高度属性设置为 100% 以便面板占用表格单元的 100% 空间,但是当我这样做时面板消失了. 只有当我将面板宽度和高度属性设置为 100px 时,才会显示它。 那么如何将面板设置为始终占据它所在的表格单元的 100%?
在此示例中,面板不显示:
<asp:Table runat="server" ID="mainTable" Width="100%" Height="100%" BorderColor="Red" BorderWidth="20px" BorderStyle="Solid">
<asp:TableRow runat="server" ID="mainRow" Width="100%" Height="100%" BorderColor="Purple" BorderWidth="20px" BorderStyle="Solid">
<asp:TableCell runat="server" ID="maincell" Width="30%" Height="100%" BorderColor="AliceBlue" BorderWidth="20px" BorderStyle="Solid">
<asp:Panel runat="server" ID="mainpanel" Width="100%" Height="100%" BackColor="Gainsboro"></asp:Panel>
</asp:TableCell>
<asp:TableCell runat="server" ID="TableCell1" Width="30%" Height="100%" BorderColor="AliceBlue" BorderWidth="20px" BorderStyle="Solid">
<asp:Panel runat="server" ID="Panel1" Width="100%" Height="100%" BackColor="Gainsboro"></asp:Panel>
</asp:TableCell>
<asp:TableCell runat="server" ID="TableCell2" Width="30%" Height="100%" BorderColor="AliceBlue" BorderWidth="20px" BorderStyle="Solid">
<asp:Panel runat="server" ID="Panel2" Width="100%" Height="100%" BackColor="Gainsboro"></asp:Panel>
</asp:TableCell>
</asp:TableRow>
</asp:table>
我在单元格中放置了一个面板,因为我想稍后在其中放置控件。
【问题讨论】: