Showing posts with label figure. Show all posts
Showing posts with label figure. Show all posts

Friday, March 16, 2012

newline in constant error

Hi,

I've been getting this error for a long time and haven't been able to figure it out. Up until now I've been doing workarounds to avoid this type of error, but I want to figure out how to fix it without the workarounds.

The error is:
CS1010: Newline in constant

And this is the code:

string scriptString = "<script language=\"JavaScript\" src=\"";
scriptString += appPath + "/js/popupmenu.js\"></script>";

The thing I really don't get is that if I put this exact same code in a cs file it compiles, but if I put it between script tags in an aspx file the error occurs...Hm, I found the answer for anyone who's interested:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;827420

However, why is this behavior by design? Shouldn't the error message be more specific if you're not supposed to put </script> in a string?

Thanks to anyone if they replied before this message gets approved.
Can you show us the full error (including the 5 lines of code that it shows)? There might be more to it.