Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

asp.net stop listview cells from wrapping

Posted on 2014-11-10
2
Medium Priority
?
248 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 2000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

783 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