[Webinar] Learn how to a build a cloud-first strategyRegister Now


Controling Datalist width

Posted on 2005-04-16
Medium Priority
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
  • 2
  • 2
  • 2
LVL 23

Accepted Solution

b1xml2 earned 2000 total points
ID: 13799768
firstly, you can use the option no wrap,

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


Author Comment

ID: 13799914
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.

Author Comment

ID: 13799931
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.
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 23

Expert Comment

ID: 13800530
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

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

Expert Comment

ID: 13804423
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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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.…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month20 days, 13 hours left to enroll

865 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