Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 How to wrap around a text using a label.

Author  Topic 

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2008-05-08 : 17:10:47
Hi Group:

Wow, I am exhausted, I need help, I need a vacation, I need to quit, I need something, I thank you in advance for your help. I have a text that is wayyyyyy to long to fit inside the screen in a label.
I need to find the way to wrap around the text within the label. I am using ASP.Net / VB.Net. Does anyone knows how to do this crazy thing? Thanks.

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-05-08 : 18:00:12
HTML wraps text unless you tell it otherwise.

If for some reason you have text not wrapping, then somewhere you have a tag or CSS class or style that is making it not wrap.



- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2008-05-08 : 18:06:25
I think is because there are not spaces in the text, so the label doesn't know where to stop.
I try to eliminate the spaces but is not working with this code.

Dim strCompanies.Replace(",", " ")
strCompanies = Session("CompanyIDs")
lblCompanies = strCompanies
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-05-08 : 18:27:17
That is not valid code that you are showing! Don't you get an error when trying to run that?

Dim strCompanies.Replace(",", " ") as String
strCompanies = Session("CompanyIDs").ToString()
lblCompanies.Text = strCompanies.Replace(","," ")

Always declare data types for your variables, and always explicitly convert or cast things as the proper data type. This is the #1 most important rule when it comes to programming.

Please consider reading a beginning Asp.net programming book so you can understand the basics of ASP.NET/VB/HTML programming.

In addition: you should not store CSV strings in Session if you are storing multiple pieces of data; just store an array there. And, finally, be sure to check that the Session value is not NOTHING otherwise you will get a runtime error.

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2008-05-08 : 18:33:31
Thank You sooooo much you are an angel
Go to Top of Page
   

- Advertisement -