|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
AJAX ScriptManager.RegisterStartupScript - JavaScript accumulatesI 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 |
|||||||||||||||||||||||