AJAX ScriptManager.RegisterStartupScript - JavaScript accumulates

Discussion in 'ASP .Net Web Controls' started by Mojo-U, Sep 4, 2007.

  1. Mojo-U

    Mojo-U Guest

    Hello,

    I have a custom server control that is being used from within an AJAX
    UpdatePanel.

    The server control is AJAX-aware and uses the
    ScriptManager.RegisterStartupScript() method to execute some JavaScript after
    the AJAX postback has occured and the HTML within the UpdatePanel has been
    updated.

    Using the IE Developer Toolbar I am able to see the source of the page after
    an AJAX postback occurs. Each time a postback occurs, I can see the new
    block of JavaScript contained in the page, along with the same block of
    JavaScript which was added to the page on all previous AJAX postbacks.

    The net effect is that whatever JavaScript I want to add via my call to
    RegisterStartupScript gets re-added to the page each time an AJAX postback
    occurs. This seems like it could be a problem if my page makes a large
    number of AJAX postbacks over time. The page would actually grow in length.

    Is there a technique I should be using that avoids this problem, or is this
    not actually a "problem" at all?

    Thanks,
    Matt
    Mojo-U, Sep 4, 2007
    #1
    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. Elmo Watson
    Replies:
    1
    Views:
    371
  2. =?Utf-8?B?TGFycnkgRXBu?=

    Ajax - Master Pages - ScriptManager - Web User Controls

    =?Utf-8?B?TGFycnkgRXBu?=, Feb 23, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    854
    Walter Wang [MSFT]
    Feb 26, 2007
  3. Steve Kershaw

    AJAX in ASP.Net ScriptManager error

    Steve Kershaw, Apr 25, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    469
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Apr 25, 2007
  4. Ryan
    Replies:
    0
    Views:
    425
  5. asp.net ajax
    Replies:
    2
    Views:
    1,603
    Gregory A. Beamer
    Dec 21, 2009
Loading...

Share This Page