c# string problem

B

Blue Man

hello
I am trying to generate a JavaScript code with asp.net pages. the generated
code contains special characters like "/" "<" and so , but when i get the
code it is changed to somthing else like : &lt;a

string temp = "<a href="+link[0]+" \"a>" + "Link</a>";

writer.WriteString(" document.write('"+temp+"'); ");

the compiler changes the characters and because of that the javascript
returens error messages. i also tried @ befor my temp string but didn't
work.

how can i avoid this?
 
C

Christopher Kimbell

Hi,

Look up the Page.RegisterClientScriptBlock() method in MSDN,
this contains a sample of how to add JavaScript to an ASP.net page.

Chris
 
B

Blue Man

Thank you Christopher
actually i solved the problem with "response.write()" method istead of XML
writer.
but i will look at that also.


Christopher Kimbell said:
Hi,

Look up the Page.RegisterClientScriptBlock() method in MSDN,
this contains a sample of how to add JavaScript to an ASP.net page.

Chris


Blue Man said:
hello
I am trying to generate a JavaScript code with asp.net pages. the generated
code contains special characters like "/" "<" and so , but when i get the
code it is changed to somthing else like : &lt;a

string temp = "<a href="+link[0]+" \"a>" + "Link</a>";

writer.WriteString(" document.write('"+temp+"'); ");

the compiler changes the characters and because of that the javascript
returens error messages. i also tried @ befor my temp string but didn't
work.

how can i avoid this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top