Solved

asp.net stop listview cells from wrapping

Posted on 2014-11-10
2
218 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
VS 2015 is giving [No relevant source lines] 2 39
ASP.NET MVC - Views 3 40
VB.net Filesystem watcher not working 5 37
VB.NET System.NullReferenceException 1 19
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 …
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…

749 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