\n not creating linefeed from code behind

Posted on 2005-04-16
Medium Priority
Last Modified: 2010-04-23
From code behind I am populating a hidden HTML input with a string containing \n.  onload of the body javascript checks the value of the hidden input and if it does not ="N" then alert what is contained in the hidden input.  The process works fine, showing the alert when appropiate, but the \n is not interpreted as a line feed in the alert, just part of the string.  Do I need escape chars or some such to consume the \n?
Question by:mbwatkins
  • 2
LVL 13

Expert Comment

by:Corey Scheich
ID: 13805396
Can you use vbCRLF

"First Line." & vbCRLF & "Second Line"


Author Comment

ID: 13811229
I figured this out.  If the string contnents I want to alert is in an HTML control (i.e. input or textarea) javascipt will treat the contents as one big string bypassing the "\n" or other escapes.  I now just response.write from the code behind the message into a javascript var on the page.  When the onload fires it has the contents I want to alert in memory and displays appropiriately.
LVL 13

Expert Comment

by:Corey Scheich
ID: 14009438
I think the points should be refunded and the question should be PAQ'd as the OP answered his own question

Accepted Solution

modulo earned 0 total points
ID: 14040534
PAQed with points refunded (500)

Community Support Moderator

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Integration Management Part 2
Suggested Courses
Course of the Month15 days, 11 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question