I’ve been looking on google about this but I can’t find a clear answer.
I’m trying to simulate an email, users will insert their text in a textarea and the text will be saved to the database. At a certain point they will come back on that page and they will be able to see their email. So I have to get it from the database. But how do I detect where the user has a newline as in end of paragraph for example?
Also when I try to alert the text of the email that I retrieved from the database I get the error “Unterminated string literal” and according to google this has to do with the line breaks.
I also know I have to replace the newlines with \n the problem is I have to find them first and I cant figure out how.
VB:
This is to get the email and storing it for my view.
Dim GetUserEmail As String = BermudaModuleComponent.GetUserEmail(userId)
ViewData("myEmail") = GetUserEmail
Return View()
Javascript:
All I do here is alerting my viewdata.
var mail = '<%=ViewData("myEmail") %>';
alert(mail.toString);
HTML:
Here I create my textarea.
$('body').prepend('<div class="overlay"></div>');
$('body').prepend('<div id="welcomeBoxBermuda"><div class="closePopup"></div><span id="send">Send</span><textarea class="EmailText" wrap="hard"></textarea></div>');
Found it now, thanks to nnnnnn.
It was
myString.Replace(Chr(10), "\n")Thanks a lot all 🙂