在html面板中的asp面板位置

时间:2014-01-02 18:27:37

标签: asp.net

我试图将asp.panel放在HTML表格中。但是100%的表高度并没有填满asp.panel的空间。有人有解决方案吗?

这是我的母版页的示例:

      <table id="TableContent" bgcolor="#565757" border="0" height="100%" cellspacing="5" cellpadding="0">
      <div id="content">
        <asp:contentplaceholder id="MainContent" runat="server">
          <tr>
            <td><!-- Page-specific content will go here... --></td>
            </tr>
          </asp:contentplaceholder>
        </div>
      </table>

这是面板的代码。

<td align="center">
<form id="kunstenaars" runat="server">

    <asp:Panel ID="Panel1" runat="server" BackColor="#565757" BorderColor="White" EnableTheming="False" EnableViewState="False" ScrollBars="None"  style="position: relative; left: auto; width: auto; height: auto; z-index: 2;">
        <asp:Literal ID="litKunstkoop" runat="server"></asp:Literal>
        <asp:HiddenField ID="hdSoort" runat="server" />
        <asp:SqlDataSource ID="Afmetingen_Datasource" runat="server" ConnectionString="<%$ ConnectionStrings:cnnSmelikStokkingWeb %>" SelectCommand="SELECT [Afmeting] FROM [Afmetingen] ORDER BY [Afmeting]" ProviderName="System.Data.SqlClient"></asp:SqlDataSource>
        <asp:Label ID="lblAfmeting" runat="server" BackColor="#565757" Font-Bold="True" Font-Names="Verdana" Font-Size="Small" ForeColor="White" style="z-index: 1; left: 277px; top: 77px; position: absolute; width: 157px" Text="Kies afmeting" Visible="False"></asp:Label>
        <asp:HiddenField ID="hdFotoCount" runat="server" Visible="False" />
        <asp:HiddenField ID="hdTaal" runat="server" />
        <asp:TextBox ID="van" runat="server" BackColor="#565757" Font-Bold="True" Font-Names="Verdana" Font-Size="X-Small" ForeColor="White" ReadOnly="True" style="z-index: 1; top: 79px; text-align: center; position: absolute; align-content: center;width: 31px; left: 630px" BorderColor="#999999">1</asp:TextBox>
        <asp:TextBox ID="streep" runat="server" BackColor="#565757" Font-Bold="True" Font-Names="Verdana" Font-Size="X-Small" ForeColor="White" ReadOnly="True" style="z-index: 1; top: 79px; text-align: center; position: absolute; align-content: center;width: 12px; left: 664px" BorderColor="#999999">-</asp:TextBox>
        <asp:TextBox ID="tm" runat="server" BackColor="#565757" Font-Bold="True" Font-Names="Verdana" Font-Size="X-Small" ForeColor="White" ReadOnly="True" style="z-index: 1; top: 79px; text-align: center; position: absolute; align-content: center;width: 31px; left: 679px;" BorderColor="#999999">20</asp:TextBox>
        <asp:ImageButton ID="btBW" runat="server" ImageUrl="Images/Goback.png" style="z-index: 1; left: 611px; top: 80px; position: absolute; height: 16px; width: 16px" />
        <asp:ImageButton ID="btFW" runat="server" ImageUrl="Images/Goforward.png" style="z-index: 1; left: 723px; top: 79px; position: absolute; height: 16x; width: 19px" />
      </asp:Panel>
    </asp:Panel>
    </form></td>

我希望有人能解决这个问题。

2 个答案:

答案 0 :(得分:0)

您的内容(来自aspx页面)将取代asp:contentplaceholder。不要在母版页的占位符中添加其他内容。只需将占位符文本放在您希望内容的位置。

<table>
  <tr><td>
    <asp:contentplaceholder />
  </td></tr>
</table>

答案 1 :(得分:0)

你可以移动表格单元格内的ContentPlaceHolder,也不能将div直接嵌套在表格内

<div id="content">
    <table id="TableContent" bgcolor="#565757" border="0" height="100%" cellspacing="5" cellpadding="0">
        <tr>
          <td>
              <!-- Page-specific content will go here... -->
              <asp:contentplaceholder id="MainContent" runat="server">
              </asp:contentplaceholder>
          </td>
        </tr>
     </table>
  </div>
相关问题