问题描述
我如何prevent表从包裹时,它是外部表格单元格内?
how do i prevent a table from wrapping when it is inside of an outer table cell?
看一看简化的例子在我的问题的底部。
我的aspx-tablerow的:
My aspx-tablerow:
<tr runat="server" id="trButtons">
<td align="left" colspan="9" valign="top" style="white-space:nowrap"><br />
<asp:Button ID="btnImeiLookup" OnClick="btnImeiLookupClick" runat="server" ValidationGroup="VG_RMA_LOOKUP" CausesValidation="true" Text="lookup IMEI" ToolTip="lookup IMEI and check if RMA-Number can be generated" Width="120px" />
<asp:Button ID="BtnEdit" CommandName="Edit" CommandArgument='<%# Eval("idRMA")%>' ValidationGroup="VG_RMA_SAVE" runat="server" CausesValidation="false" Text="Edit" ToolTip="edit" Width="120px" />
<asp:Button ID="BtnAdd" runat="server" CommandName="Add" CausesValidation="false" Text="Add new" Width="130px" ToolTip="add new" />
<asp:Button ID="BtnDelete" runat="server" CommandName="Delete" CommandArgument='<%# Eval("idRMA")%>' CausesValidation="true" Text="Delete" Width="120px" ToolTip="delete" OnClientClick="return confirm('do you really want to delete this RMA?')" />
<uc4:RmaPrinterView ID="RmaPrinterView1" Visible="true" runat="server" />
</td>
</tr>
RmaPrinterView1是一个ASP.Net用户控件:
RmaPrinterView1 is an ASP.Net Usercontrol:
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<input type="button" style="width:120px; white-space:nowrap" onclick="javascript:$('#TblPrinterView').jqprint();" value="Print" title="Print" />
</td>
</tr>
<tr>
<td>
<table id="TblPrinterView" style="display:none">
<tr>
<td style="width:100px;white-space:nowrap">
<asp:Label ID="LblRmaNumberDesc" runat="server" Text="RMA-Number:"></asp:Label>
</td>
<td>
<asp:Label ID="LblRmaNumber" runat="server" Text="xxxxxxxxxxxxxx"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="LblImeiDesc" runat="server" Text="IMEI:"></asp:Label>
</td>
<td>
<asp:Label ID="LblImei" runat="server" Text="xxxxxxxxxxxxxx"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="LblModelDesc" runat="server" Text="Model:"></asp:Label>
</td>
<td>
<asp:Label ID="LblModel" runat="server" Text="xxxxxxxxxxxxxx"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="LblSiDpyDesc" runat="server" Text="SI/DPY:"></asp:Label>
</td>
<td>
<asp:Label ID="LblSiDpy" runat="server" Text="xxxxxxxxxxxxxx"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="LblSymptomCodesDesc" runat="server" Text="Symptoms:"></asp:Label>
</td>
<td>
<asp:Label ID="LblSymptomCodes" runat="server" Text="xxxxxxxxxxxxxx"></asp:Label>
</td>
</tr>
</table>
</td>
</tr>
</table>
正如你所看到的,与内表中的用户控件包:
As you can see, the Usercontrol with the inner table is wrapped:
我知道我应该避免表的布局。但我需要一个快速的工作液; - )
I know that i should avoid table layout. But i needed a fast working solution ;-)
感谢你在前进。
修改:一个简化的样本也被包裹:
EDIT: a simplified sample that is also wrapping:
<table>
<tr>
<td style="white-space:nowrap">
<input type="button" value="b1" />
<input type="button" value="b2" />
<input type="button" value="b3" />
<table>
<tr>
<td style="white-space:nowrap"><input type="button" value="in table" /></td>
</tr>
</table>
</td>
</tr>
</table>
更新:该解决方案 - 为吉荣提到的 - 是使表内联元素风格=显示:内联
。接下来的问题是,我用一个ASP.Net的UpdatePanel它通常呈现为一个DIV用户控件内。因此,下一个块元素,导致我的桌子包。我只需要设置的UpdatePanel的RenderMode 到内联
是什么原因导致它呈现为跨度。
UPDATE:The solution - as Jeroen mentioned - was to make the table an inline element with style="display: inline"
. The next problem was that i used an ASP.Net UpdatePanel inside the UserControl which is normally rendered as a Div. So the next block-element that causes my table to wrap. I only needed to set the UpdatePanel's RenderMode to Inline
what causes it to be rendered as Span.
感谢大家。
推荐答案
如果该CSS 空格
不工作,你可以尝试添加 NOWRAP =NOWRAP
您 D
,就像你加入 VALIGN =顶
。
If the css white-space
does not work, you can try to add nowrap="nowrap"
to your td
, just like you added valign="top"
.
非常难看,但它应该工作。
Very ugly, but it should work.
编辑:啊,现在我明白了:一个表是一个块级元素,因此总是会去一个新的行,除非你把它内联元素或浮起来。
Ah, now I see: A table is a block-level element so it will always go to a new line unless you make it an inline-element or float it.
这篇关于从包装prevent表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!