Alina Anjum
Alina Anjum

Reputation: 1230

How to prevent line break in listitems of asp:bulletedlist?

I am displaying some content in this list from other source.but due to the length of text,some list items automatically having line breaks.How can I prevent this? Here is my list :

<asp:BulletedList DisplayMode="LinkButton" OnClick="lstDirs_Click" id="lstDirs"  runat="server" ></asp:BulletedList>

Upvotes: 0

Views: 193

Answers (1)

Andrei
Andrei

Reputation: 56688

Assign a css class to the list control:

<asp:BulletedList CssClass="dirsList" ...

And then define the necessary CSS to make sure individual items in this list do not break the line. You would use white-space: nowrap; for that. Be aware that this needs to be applied to the individual items, that is to the li in the output markup. So, in your css file:

.dirsList li {
    white-space: nowrap;
}

Upvotes: 1

Related Questions