我有一張具有特定佈局的表格。它開始是這樣的:更改代碼中的HTML表格
<table>
<tr bgcolor="#007ACC" style="color:White">
<td width="145"><asp:Label Text="" ID="lblLevel" runat="server" /></td><td width="80"></td><td width="30"></td><td width="145"><asp:Label Text="" ID="lblGroupNumber" runat="server" /></td><td width="60"></td><td width="10">Active</td>
</tr>
<tr>
<td colspan="5">
<asp:TextBox ID="txtName" runat="server" width="460px"></asp:TextBox>
</td>
<td>
<asp:DropDownList ID="cboActive" runat="server" Width="50px">
<asp:ListItem>Y</asp:ListItem>
<asp:ListItem>N</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
的問題是,在某些情況下,我需要它看起來像這樣:
<table>
<tr bgcolor="#007ACC" style="color:White">
<td width="145"><asp:Label Text="" ID="lblLevel" runat="server" /></td><td width="80"></td><td width="30"></td><td width="145"><asp:Label Text="" ID="lblGroupNumber" runat="server" /></td><td width="60"></td><td width="10">Active</td>
</tr>
<tr>
<td colspan="2">
<asp:TextBox ID="txtName" runat="server" width="460px"></asp:TextBox>
</td>
<td></td>
<td colspan="2">
<asp:TextBox ID="txtNumber" runat="server" width="460px"></asp:TextBox>
</td>
<td>
<asp:DropDownList ID="cboActive" runat="server" Width="50px">
<asp:ListItem>Y</asp:ListItem>
<asp:ListItem>N</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
我以前隱藏的文本框,那也沒問題。但我能想到的唯一辦法就是使用代碼隱藏td's
。我已經看到了這一點:
How to hide columns in HTML table?
,但他們從來沒有解釋如何確定哪些td
被隱藏。
所以,這可以在代碼中完成(最好在C#中的代碼隱藏)?如果是這樣,怎麼樣?
F'n brilliant,brotha!萬分感謝! –
沒問題的隊友 –