escape problem

Discussion in 'ASP .Net' started by =?Utf-8?B?RGFu?=, Jun 7, 2006.

  1. I'm using asp.net c#

    in my code behind I coded the following:
    ButtonAsynchronous.Attributes.Add("onclick", @" setTimeout(
    ""UpdateImg('AnimatedProgress','images/running.gif');"" , 50); ");

    This renders into:
    onclick=" setTimeout( "UpdateImg('AnimatedProgress','images/running.gif');"
    , 50); ;" id="ButtonAsynchronous" />

    I see the quotes have been escaped, which is in this case wrong as they need
    to be preserved.

    How should I do this?
    =?Utf-8?B?RGFu?=, Jun 7, 2006
    #1
    1. Advertising

  2. =?Utf-8?B?RGFu?=

    mnichols Guest

    I tried your sample in VS 2003 and VS 2005 and in both cases the
    rendered html contained something like the following:

    onclick="setTimeout("UpdateImg('AnimatedProgress','images/running.gif');"",
    50); ;" id="ButtonAsynchronous" />

    I think in your message and possibly mine the &quot is being changed
    into a " though maybe this is a ThunderBird issue on my end.

    Anyhow, regardless of the display issue, the code executed properly so I
    am not sure if there is a problem?

    mnichols

    Dan wrote:
    > I'm using asp.net c#
    >
    > in my code behind I coded the following:
    > ButtonAsynchronous.Attributes.Add("onclick", @" setTimeout(
    > ""UpdateImg('AnimatedProgress','images/running.gif');"" , 50); ");
    >
    > This renders into:
    > onclick=" setTimeout( "UpdateImg('AnimatedProgress','images/running.gif');"
    > , 50); ;" id="ButtonAsynchronous" />
    >
    > I see the quotes have been escaped, which is in this case wrong as they need
    > to be preserved.
    >
    > How should I do this?
    mnichols, Jun 7, 2006
    #2
    1. Advertising

  3. Mnicholas,

    Indeed it's the &quot which is the problem.
    In my code I use " (a double quote sign) which is being escaped.

    Unfortunately in IE6 the code generates an error which it should as the
    asp.net generated code is wrong.

    So what should I need do to NOT escape my double quote sign?

    Dan

    "mnichols" wrote:

    > I tried your sample in VS 2003 and VS 2005 and in both cases the
    > rendered html contained something like the following:
    >
    > onclick="setTimeout("UpdateImg('AnimatedProgress','images/running.gif');"",
    > 50); ;" id="ButtonAsynchronous" />
    >
    > I think in your message and possibly mine the " is being changed
    > into a " though maybe this is a ThunderBird issue on my end.
    >
    > Anyhow, regardless of the display issue, the code executed properly so I
    > am not sure if there is a problem?
    >
    > mnichols
    >
    > Dan wrote:
    > > I'm using asp.net c#
    > >
    > > in my code behind I coded the following:
    > > ButtonAsynchronous.Attributes.Add("onclick", @" setTimeout(
    > > ""UpdateImg('AnimatedProgress','images/running.gif');"" , 50); ");
    > >
    > > This renders into:
    > > onclick=" setTimeout( "UpdateImg('AnimatedProgress','images/running.gif');"
    > > , 50); ;" id="ButtonAsynchronous" />
    > >
    > > I see the quotes have been escaped, which is in this case wrong as they need
    > > to be preserved.
    > >
    > > How should I do this?

    >
    =?Utf-8?B?RGFu?=, Jun 7, 2006
    #3
  4. =?Utf-8?B?RGFu?=

    mnichols Guest

    I think another error is causing the problem. The &quot is actually
    perfect for the situation. If it were not escaped as it is, then you
    would get a different error.

    I gather that you are saying that IE6 is generating a javascript error
    of some sort? Is it possible that there is an error in the UpdateImg
    function? Try calling it without the setTimeout wrapper (maybe in the
    page's onload event) and maybe you will see the other error.

    Debugging code triggered by a setTimeout is tricky because VS usually
    can't associate it with the original page

    mnichols

    Dan wrote:
    > Mnicholas,
    >
    > Indeed it's the &quot which is the problem.
    > In my code I use " (a double quote sign) which is being escaped.
    >
    > Unfortunately in IE6 the code generates an error which it should as the
    > asp.net generated code is wrong.
    >
    > So what should I need do to NOT escape my double quote sign?
    >
    > Dan
    >
    > "mnichols" wrote:
    >
    >> I tried your sample in VS 2003 and VS 2005 and in both cases the
    >> rendered html contained something like the following:
    >>
    >> onclick="setTimeout("UpdateImg('AnimatedProgress','images/running.gif');"",
    >> 50); ;" id="ButtonAsynchronous" />
    >>
    >> I think in your message and possibly mine the " is being changed
    >> into a " though maybe this is a ThunderBird issue on my end.
    >>
    >> Anyhow, regardless of the display issue, the code executed properly so I
    >> am not sure if there is a problem?
    >>
    >> mnichols
    >>
    >> Dan wrote:
    >>> I'm using asp.net c#
    >>>
    >>> in my code behind I coded the following:
    >>> ButtonAsynchronous.Attributes.Add("onclick", @" setTimeout(
    >>> ""UpdateImg('AnimatedProgress','images/running.gif');"" , 50); ");
    >>>
    >>> This renders into:
    >>> onclick=" setTimeout( "UpdateImg('AnimatedProgress','images/running.gif');"
    >>> , 50); ;" id="ButtonAsynchronous" />
    >>>
    >>> I see the quotes have been escaped, which is in this case wrong as they need
    >>> to be preserved.
    >>>
    >>> How should I do this?
    mnichols, Jun 7, 2006
    #4
  5. mnichols,

    You're absolutly correct! To verify where the error was I tried the code in
    firefox, it works. I then cleared the cache in explorer and tried again,
    works as well

    I need to use setTimeout to reload an animated gif after form submission to
    make it animate. Debugging is therefore not a problem as asp callback is
    running as the setTimeout is called and the page will be overwritten with the
    asp result.

    Thanks for your assistance!

    Dan

    "mnichols" wrote:

    > I think another error is causing the problem. The " is actually
    > perfect for the situation. If it were not escaped as it is, then you
    > would get a different error.
    >
    > I gather that you are saying that IE6 is generating a javascript error
    > of some sort? Is it possible that there is an error in the UpdateImg
    > function? Try calling it without the setTimeout wrapper (maybe in the
    > page's onload event) and maybe you will see the other error.
    >
    > Debugging code triggered by a setTimeout is tricky because VS usually
    > can't associate it with the original page
    >
    > mnichols
    >
    > Dan wrote:
    > > Mnicholas,
    > >
    > > Indeed it's the " which is the problem.
    > > In my code I use " (a double quote sign) which is being escaped.
    > >
    > > Unfortunately in IE6 the code generates an error which it should as the
    > > asp.net generated code is wrong.
    > >
    > > So what should I need do to NOT escape my double quote sign?
    > >
    > > Dan
    > >
    > > "mnichols" wrote:
    > >
    > >> I tried your sample in VS 2003 and VS 2005 and in both cases the
    > >> rendered html contained something like the following:
    > >>
    > >> onclick="setTimeout("UpdateImg('AnimatedProgress','images/running.gif');"",
    > >> 50); ;" id="ButtonAsynchronous" />
    > >>
    > >> I think in your message and possibly mine the " is being changed
    > >> into a " though maybe this is a ThunderBird issue on my end.
    > >>
    > >> Anyhow, regardless of the display issue, the code executed properly so I
    > >> am not sure if there is a problem?
    > >>
    > >> mnichols
    > >>
    > >> Dan wrote:
    > >>> I'm using asp.net c#
    > >>>
    > >>> in my code behind I coded the following:
    > >>> ButtonAsynchronous.Attributes.Add("onclick", @" setTimeout(
    > >>> ""UpdateImg('AnimatedProgress','images/running.gif');"" , 50); ");
    > >>>
    > >>> This renders into:
    > >>> onclick=" setTimeout( "UpdateImg('AnimatedProgress','images/running.gif');"
    > >>> , 50); ;" id="ButtonAsynchronous" />
    > >>>
    > >>> I see the quotes have been escaped, which is in this case wrong as they need
    > >>> to be preserved.
    > >>>
    > >>> How should I do this?

    >
    =?Utf-8?B?RGFu?=, Jun 7, 2006
    #5
    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. Jeff S
    Replies:
    12
    Views:
    13,844
    Jeff S
    Nov 10, 2003
  2. =?Utf-8?B?Q29vbEtpd2lCbG9rZQ==?=

    URL Escape Character Problem (Bug in ASP.NET??)

    =?Utf-8?B?Q29vbEtpd2lCbG9rZQ==?=, Mar 8, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    4,677
    Joerg Jooss
    Mar 10, 2005
  3. Escape problem

    , Mar 2, 2004, in forum: Python
    Replies:
    4
    Views:
    726
  4. slomo
    Replies:
    5
    Views:
    1,506
    Duncan Booth
    Dec 2, 2007
  5. BlueMac

    Javascript \ Escape problem

    BlueMac, Nov 4, 2003, in forum: Javascript
    Replies:
    2
    Views:
    87
    David Leverton
    Nov 5, 2003
Loading...

Share This Page