2015-09-07 179 views
0
<table> 
     <tr> 
      <td> 
       <asp:Label Text="Team :" runat="server"></asp:Label></td> 
      <td> 
       <asp:DropDownList ID="ddlProject" OnSelectedIndexChanged="itemSelected" AutoPostBack="True" runat="server"></asp:DropDownList></td> 
     </tr> 
     <tr> 
      <td> 
       <asp:Label Text="Project :" runat="server"></asp:Label></td> 
      <td> 
       <asp:DropDownList ID="ddlDetails" runat="server"></asp:DropDownList></td> 
     </tr> 
     <tr> 
      <td> 
       <asp:Button ID="btnBugSubmit" Text="Bug" OnClick="btnBugSubmit_Click" runat="server"/></td> 
      <td> 
       <asp:Button ID="btnIssueSubmit" Text="Issue" OnClick="btnIssueSubmit_Click" runat="server"/></td> 
      <td > 
       <asp:Button ID="btnReqSubmit" Text="Requisition" OnClick="btnReqSubmit_Click" runat="server"/></td> 
     </tr> 
    </table> 

其中一个按钮“btnReqsubmit”(下面圈出)未对齐,我不知道为什么。 我的代码有什么问题吗?表中的asp.net按钮未对齐

enter image description here

+0

能否请您创建_complete_和_relevant_代码 – Tushar

+0

一个可能的快速技巧来解决这个jsfiddle.net演示;从最后一个tr中移除所有三个td,并指定一个带colspan = 3的td,并将​​所有按钮都包含在内。 –

回答

0

可能的解决方案。理想情况下,每行应该有相同数量的td
在您的第一个tr中,您只有2个td,而在另一个中您有3个td

您可以visit here看到合并单元格属性

<table> 
     <tr> 
      <td> 
       <asp:Label Text="Team :" runat="server"></asp:Label> 
      </td> 
      <td colspan="2"> 
       <asp:DropDownList ID="ddlProject" OnSelectedIndexChanged="itemSelected" 
        AutoPostBack="True" runat="server"></asp:DropDownList> 
      </td> 
     </tr> 
     <tr> 
      <td> 
       <asp:Label Text="Project :" runat="server"></asp:Label> 
      </td> 
      <td colspan="2"> 
       <asp:DropDownList ID="ddlDetails" runat="server"> 
       </asp:DropDownList> 
      </td> 
     </tr> 
     <tr> 
      <td> 
       <asp:Button ID="btnBugSubmit" Text="Bug" 
        OnClick="btnBugSubmit_Click" runat="server"/> 
      </td> 
      <td> 
       <asp:Button ID="btnIssueSubmit" Text="Issue" 
       OnClick="btnIssueSubmit_Click" runat="server"/> 
      </td> 
      <td > 
       <asp:Button ID="btnReqSubmit" Text="Requisition" 
       OnClick="btnReqSubmit_Click" runat="server"/> 
      </td> 
     </tr> 
    </table> 
0

此问题是因为第二线project下拉宽度的情况是更

如果您使用的表结构这个问题会

因为列的宽度将被调整到列中单元的最大宽度

使用divspan代替

看到下面的演示

input[type="button"] { 
 
    margin:5px; 
 
    width:50px; 
 
} 
 

 
label { 
 
    border:none 
 
    width:10px; 
 
} 
 
select { 
 
    width:100px; 
 
}
<div> 
 
     <div> 
 
      <span> 
 
       <label>Text</label></span> 
 
      <span> 
 
       <select></select></span> 
 
     </div> 
 
     <div> 
 
      <span> 
 
       <label>Text</label></span> 
 
      <span> 
 
       <select></select></span> 
 
     </div> 
 
     <div> 
 
      <span> 
 
       <input type="button"/></span> 
 
      <span> 
 
       <input type="button"/></span> 
 
      <span> 
 
       <input type="button"/></span> 
 
     </div> 
 
    </div>

0

你已经创建了2个细胞前两行和3最后一排,所以

替换最后tr与下面的代码

<tr> 
      <td> 
       <asp:Button ID="btnBugSubmit" Text="Bug" OnClick="btnBugSubmit_Click" runat="server"/></td> 
      <td> 
       <asp:Button ID="btnIssueSubmit" Text="Issue" OnClick="btnIssueSubmit_Click" runat="server"/> 

       <asp:Button ID="btnReqSubmit" Text="Requisition" OnClick="btnReqSubmit_Click" runat="server"/></td> 
     </tr>