 |
BOOK: Professional Web 2.0 Programming  | This is the forum to discuss the Wrox book Professional Web 2.0 Programming by Eric van der Vlist, Danny Ayers, Erik Bruchez, Joe Fawcett, Alessandro Vernet; ISBN: 9780470087886 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Professional Web 2.0 Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

March 31st, 2010, 10:07 AM
|
|
Friend of Wrox
|
|
Join Date: Dec 2008
Posts: 238
Thanks: 2
Thanked 20 Times in 19 Posts
|
|
What is the problem? On C# side? On javascript side? Please provide the exact testing code you used and the exact error message you saw. Also tell me what browser (and version number) you used to test.
Once you send to me those, I will help you find out the exact issue.
|
|

March 31st, 2010, 10:15 AM
|
|
Authorized User
|
|
Join Date: Feb 2008
Posts: 89
Thanks: 13
Thanked 0 Times in 0 Posts
|
|
This works fine:
Code:
Response.Write(@"msman88 is\
Abdul-Rhman");
and this does not woork
Code:
Response.ContentType = "text/javascript";
Response.Write(@"document.write('hello \
world')");
I mean by work is that output is satisfiable, please try it out.
browser: any browser.
__________________
ASP.NET & C#
|
|

March 31st, 2010, 10:26 AM
|
|
Friend of Wrox
|
|
Join Date: Dec 2008
Posts: 238
Thanks: 2
Thanked 20 Times in 19 Posts
|
|
When you said that the second piece of code didn't work, what was your observation? what was the issue?
You realize that your second piece of code is just one line of javascript, what you expect in the browser should be this string:'document.write("foo");' but not this string: "foo". (You expect the javascript as it is, but don't expect the result from the execution of the script.)
Let's make sure we expect the same thing.
|
|

March 31st, 2010, 10:31 AM
|
|
Authorized User
|
|
Join Date: Feb 2008
Posts: 89
Thanks: 13
Thanked 0 Times in 0 Posts
|
|
What I want to do is that making "new line in constant" I mean in the string of Response.write. and that purpose is to nest the code.
I use "@" to make that and worked fine but only without the line
Code:
Response.ContentType = "text/javascript";
and when having that line, the "@" is stopping it's job.
__________________
ASP.NET & C#
|
|

March 31st, 2010, 10:37 AM
|
|
Friend of Wrox
|
|
Join Date: Dec 2008
Posts: 238
Thanks: 2
Thanked 20 Times in 19 Posts
|
|
Do you expect hello and world show up on two separate lines when the message pop up? If so, take a look at the following:
Code:
<html>
<head>
<script type="text/javascript">
function a() {
alert("hello\r\nworld");
}
</script>
</head>
<body>
<input type="button" onclick="a()">
</body>
</html>
|
|

March 31st, 2010, 10:43 AM
|
|
Authorized User
|
|
Join Date: Feb 2008
Posts: 89
Thanks: 13
Thanked 0 Times in 0 Posts
|
|
The purpose of javascript is not a pop up, but is just plain text represents a javascript code that's is used by another pages, or in other hand, that javascript code is referred by other pages that uses javascript, (it's an advertisement network) and that javascript is is ads called by publisher pages.
__________________
ASP.NET & C#
|
|

April 1st, 2010, 09:55 AM
|
|
Friend of Wrox
|
|
Join Date: Dec 2008
Posts: 238
Thanks: 2
Thanked 20 Times in 19 Posts
|
|
Let's go back to the white board, and get to the bottom of this. There are better ways.
Piece together this thread and couple other threads that you created recently. What you are doing is to generate a javascript from one ASP.Net page, then have a second ASP.net consume this generated javascript, right? You try to insert new lines into the generated script, I guess, for the purpose to make it more human readable.
Maybe it is unintentional, but you actually use javascript as way of passing data from the first ASP.net page to the second one That is not the right way, and it complicates things for you.
There are many other ways of passing data around: session, cookie ... You need give more thought to your design.
|
|
 |