Solved

asp.net stop listview cells from wrapping

Posted on 2014-11-10
2
216 Views
Last Modified: 2014-11-11
I have a ListView control on a ASP form and I want to stop the individual cells from wrapping when the content is wider than the width of the cell.  How can you do this?
0
Comment
Question by:Siv
2 Comments
 
LVL 20

Accepted Solution

by:
Daniel Van Der Werken earned 500 total points
ID: 40434959
I've not tested this, so I'm not 100% sure about the implementation, but to keep text from wrapping in *any* HTML element, this works like a charm:

<span style="white-space: nowrap;">Some really long text here you don't want wrapping.</span>

Open in new window


Put this HTML in your ListView text HTML and it should keep it from wrapping. You might be able to no-wrap the containing DIV instead it's a problem adding it to the ListView iteself.
0
 

Author Closing Comment

by:Siv
ID: 40435108
Dan7el

Brilliant I just surrounded the table in the Layout template with your span and it works:

                        <span style="white-space: nowrap;">
                        <table id="itemPlaceholderContainer" runat="server" border="1" style="background-color:royalblue; border-collapse: collapse;border-color: black;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;font-size:8pt;">
                            <tr runat="server" style="background-color:royalblue;color: white;">
                                <th runat="server">Select Item</th>
                                <th runat="server">Customer Name</th>
                                <th runat="server">Store Name</th>
                                <th runat="server">Officer Name</th>
                                <th runat="server">Total Amount</th>
                            </tr>
                            <tr id="itemPlaceholder" runat="server" >
                            </tr>
                        </table>
                        </span>

Thanks for your help.

Siv
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question