c# string problem

Discussion in 'ASP .Net' started by Blue Man, Nov 2, 2003.

  1. Blue Man

    Blue Man Guest

    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?
    Blue Man, Nov 2, 2003
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:#t6Ug$...
    > 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?
    >
    >
    Christopher Kimbell, Nov 2, 2003
    #2
    1. Advertising

  3. Blue Man

    Blue Man Guest

    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" <> wrote in message
    news:3fa52691$...
    > 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" <> wrote in message
    > news:#t6Ug$...
    > > 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?
    > >
    > >

    >
    >
    Blue Man, Nov 2, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mladen Adamovic
    Replies:
    0
    Views:
    731
    Mladen Adamovic
    Dec 4, 2003
  2. Mladen Adamovic
    Replies:
    3
    Views:
    14,588
    Mladen Adamovic
    Dec 5, 2003
  3. Matt
    Replies:
    3
    Views:
    496
    Tor Iver Wilhelmsen
    Sep 17, 2004
  4. Bruce Sam
    Replies:
    15
    Views:
    7,900
    John C. Bollinger
    Nov 19, 2004
  5. =?Utf-8?B?UmFqZXNoIHNvbmk=?=

    'System.String[]' from its string representation 'String[] Array'

    =?Utf-8?B?UmFqZXNoIHNvbmk=?=, May 4, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    1,796
    =?Utf-8?B?UmFqZXNoIHNvbmk=?=
    May 4, 2006
Loading...

Share This Page