Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > AJAX ScriptManager.RegisterStartupScript - JavaScript accumulates

Thread Tools

AJAX ScriptManager.RegisterStartupScript - JavaScript accumulates

Posts: n/a

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

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

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?

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
An Ajax Dictionary... My first AJAX project... HTML 20 03-31-2008 01:24 PM
ASP.NET and AJAX: JavaScript files from the Microsoft AJAX Library Nathan Sokalski ASP .Net 2 06-02-2007 12:07 AM
AJAX IDE and AJAX TOOL--The Release of JoyiStar AJAX WebShop 3 Beta minnie Java 1 12-13-2006 06:29 AM
Ajax installed.. where are Ajax controls like popup in my VS toolbox ?? jobs ASP .Net 0 11-06-2006 01:23 AM
beginner AJAX questions ( darrel ASP .Net 5 04-28-2006 06:42 PM