Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Actually in am binding data from database to label while binding if the word is like below means it is spoiling the UI of my site.so i decided to wrap the text when the word is to long i want to wrap. is it possible.

example :-

the text is "haithisisnitishhowruisitokforutotalkwithmehowtocontactwithu"

the above text i want to wrap it
Posted
Updated 23-Mar-14 19:30pm
v2
Comments
What have you tried so far?
ntitish 24-Mar-14 1:39am    
<div style="float:left;overflow-y:auto;overflow-x:auto; word-break:break-all;">
<asp:Label ID="lblNoteTest" runat="server" color="#898989" Text='<%# Eval("NoteText") %>' Font-Size="10pt" >
</div>
ntitish 24-Mar-14 1:42am    
in that problem is at the end of the line word is breaking like application is the last word of the line means app - Next line lication like this it is displaying
Set some width for the Label and try.
ntitish 24-Mar-14 1:52am    
no its not working even i tried that to.

1 solution

Refer - Re: How to wrap label text ?[^].
Quote:
Set a fixed width and use Word-break:break-all to strictly wrap the content.
ASP.NET
<asp:Label Text="sdasdasdasdadadadasdafadfakfdf,addasdasdsdafdfqffwgwqefwgwrgvwvwrvwv" Width="40px" runat="server" Style="word-wrap: normal; word-break: break-all;"  />
 
Share this answer
 
Comments
ntitish 24-Mar-14 2:05am    
for the above code what will be the result sir, bec for me it is dividing the word with 4-6 characters and displaying like below

sdasda
sdasdad
adadasda
fadfakfd
f,addas
dasdsdafd
fqffwgwqe
fwgwrgvwv
wrvwvsdas
dasdasdad
adadasdaf
adfakfdf
Yes, that depends upon the Width. So, if you want your line to be more wide, then increase the Width.
ntitish 24-Mar-14 5:27am    
its not working sir, actually my label is in a repeater control so i adjusted width then also it is showing like above comment.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900