Prevent table from wrapping
.net, asp.net, css, html, html-table
Solution
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.
Edit: 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.
Problem
How do I prevent a table from wrapping when it is inside of an outer table cell? Have a look at the simplified example at the bottom of my question. 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 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> ``` 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.