Controling Datalist width

Posted on 2005-04-16
Last Modified: 2012-06-27

I have a datalist that displays a list of URL.
I have the datalist inside a div with a width of 300px.
Some of this URLs are too long and exceed the 300px causing the
datalist to stretching up to 400 or 500 causing a mess in my page. I'd
rather prefer them to look trimmed or wrapped but not to causing the
datalist width to grow.

I tried several techniques with no luck. I put a span surrounding the
linkbutton, also a div, both with a widht of 280px. Also even tried to
create another table cell by placing additional TDs in the item
template. None of this can keep the datalist in the fixed width I want.

Any help is greatly appreciated.
Question by:fischermx
    LVL 23

    Accepted Solution

    firstly, you can use the option no wrap,

    secondly, you can add this to your table's stylesheet:
    LVL 1

    Author Comment

    Do I need something else ?
    I tried, but I still getting the same effect, see my code :

                    <asp:repeater id="Repeater1" runat="server">
                            <table border="1" style="TABLE-LAYOUT: fixed; WIDTH: 300px" width="300" >
                            <col width="300">
                                    <td><b class="tableTitle">Vendor</b></td>
                                    <td><b class="tableTitle">Category</b></td>
                                    <td><b class="tableTitle">Count</b></td>

    btw, I change to use a "repeater" to see if it helped, but it behaves the same, the problem is really the table growing, how to make that a table gets really fixed width.
    LVL 1

    Author Comment

    Oops, sorry, my mistake, it works !

    Just a funny behavior, I have two labels displaying in the same cell, one above other separated by a <br>.
    Now the upper label, very long, gets cut, nice, that's what I want, however, in this cases, a blank row is inserted between the two labels. It is like if the upper label would wrap, I mean, it behaves like if it would be wrapped, however, it doesn't wrap, just cut off.
    LVL 23

    Expert Comment

    that;s the behavior of the table-layout when set to fixed, it guarantees no matter what, the width is fixed.
    LVL 26

    Expert Comment

    have u tried specifying the width for the datalist to 300px ..
    LVL 26

    Expert Comment

    try defining the div tag with style
    DISPLAY: inline; OVERFLOW: auto; WIDTH: 300px; POSITION: absolute; HEIGHT: 300px

    This should give a scroll bar to the div tag when the content within it exceeds the width specified

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
    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 …
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now