Apparently, the Web Forms Label Control can't recognize a carriage return / line feed and handle it properly... am I going to have to seek out a third party control for this? If so, any recommendations?
Printable View
Apparently, the Web Forms Label Control can't recognize a carriage return / line feed and handle it properly... am I going to have to seek out a third party control for this? If so, any recommendations?
Labels can handle multi-lines but a web form requires HTML. Replace the vbCrLf with <br> and your all set.Quote:
Originally posted by kcornell
Apparently, the Web Forms Label Control can't recognize a carriage return / line feed and handle it properly... am I going to have to seek out a third party control for this? If so, any recommendations?
John
Thanks for the info (new to ASP here). What I was doing was changing a label's text to a textbox's text when a button was pushed, I just used a run-of-the-mill ReplaceString function to find all the vbCrLf's and put in "<br>"s and it worked like a charm.
Glad it worked.
You can also use the built-in Replace function/method. All Strings have it by default.
MyLabel.Text = MyTextBox.Text.Replace(vbCrLf,"<br>")
- or -
MyTextBox.Text = MyLabel.Text.Replace("<br>",vbCrLf)
John