Having an issue using JavaScript to update an Update Panel with Multiple Update Panels

I am using JavaScript via the '__doPostBack' command passing in the 'ClientID' of my UpdatePanel to do a partial page postback.  This fires the UpdatePanel_PreRender event (or any other UpdatePanel event) where I run server side code. The actual partial page postback is working as expected, but since partial postbacks follow the full page lifecycle, ALL of my UpdatePanel events are firing which I do not want.  What ends up happening is the code in the other UpdatePanel '_PreRender' event is being called too which I do not want to occur.

Is there a way around this?  Is it possible to sniff out which UpdatePanel's _EVENTTARGET was passed and only run that UpdatePanel's server side event?  Or if the other events still need to fire, if I could have code that would skip them within the event with something like:

If e.EventTarget = "MyUpdatePanelID" Then etc.

 Any help is appreciated, thanks! Confused

Thank you,

4/20/2009 2:17:05 PM
asp.net.ajax-ui 9760 articles. 0 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 57

I think you can chek with Sys.WebForms.PageRequestManager.getInstance().add_endRequest(
function(sender, e) {

In this event you check if the panel 2 visisble then do your stuff


Chetan Sarode
Software Engineer,
Approva Systems Pvt Ltd,
Pune, India.
4/22/2009 3:22:15 AM

Thank you for the response, but it was not quite exactly what I needed.  The post you offered was more for disabling a control that caused the postback so the client could not press it again to start the process twice.

My issue was more along the lines that I did not want to go through the entire full page load cycle each time a partial post back occured.  This is not possible, but one way of circumventing this is to follow the code posted at this site:  http://ryanfarley.com/blog/archive/2005/03/11/1886.aspx  I could determine just the control that caused the post back and ignore all other server side events to unrelated controls.

My problem really stemmed from the fact that I was using the UpdatePanel_PreRender event for each update panel server side code when initiating a partial page postback from Javascript.  Because the UpdatePanel events are called in each page cycle, it was difficult to figure out how to avoid calling the code in each updatepanel for each partial page postabck.  However, button click events are not called in each page load cycle.  Therefore the answer for me was to use hidden button wired up events for the partial page post backs.  They would only be called by the ID intiated from JavaScript and I did not have to worry about any UpdatePanel PreRender events being called.

Thank you,

4/24/2009 1:04:33 PM

Web resources about - Having an issue using JavaScript to update an Update Panel with Multiple Update Panels - asp.net.ajax-ui

JavaScript Kit- Your comprehensive JavaScript, DHTML, CSS, and Ajax stop
Your comprehensive JavaScript, DHTML, CSS, and Ajax stop

Let's Code: Test-Driven Javascript by James Shore — Kickstarter
James Shore is raising funds for Let's Code: Test-Driven Javascript on Kickstarter! A screencast series focusing on rigorous, professional Javascript ...

Eloquent JavaScript: A Modern Introduction to Programming
... and pragmatics. I loved the tutorial-style game-like program development. This book rekindled my earliest joys of programming. Plus, JavaScript! ...

Lightbox (JavaScript) - Wikipedia, the free encyclopedia
On a Lightbox-enabled page, a user can click an image to have it magnified in a Lightbox window, which resizes itself according to the size of ...

Open Directory - Computers: Programming: Languages: JavaScript: Tools: Obfuscators
about dmoz - help Top : Computers : Programming : Languages : JavaScript : Tools : Obfuscators Tools for obfuscation/compression JavaScript code. ...

Facebook File-Transfer App Pipe Relaunches, Now Works Via JavaScript, WebRTC
... allowed Facebook users to send and receive files up to 1 gigabit in size. A new version of Pipe debuted Monday, and the app now works via JavaScript ...

Under the Hood: The JavaScript SDK - The use of polyfills - Facebook
Facebook Engineering hat eine Notiz mit dem Titel Under the Hood: The JavaScript SDK - The use of polyfills geschrieben. Du kannst den vollständigen ...

JavaScript SDK - Facebook-Entwickler
Overview The JavaScript SDK provides a rich set of client-side functionality for accessing Facebook...

Senior Front-End Developer (Javascript and AJAX)
Company: Sometrics Category: Software Development Location: Los Angeles, CA How to Apply: jobs@sometrics.com Description: We are looking for ...

Badass JavaScript (@badass_js) on Twitter
WebGLWorker is an open source library that allows using WebGL from Web Workers. Great work as always from @kripken . blog.mozilla.org/research/2014/… ...

Resources last updated: 12/7/2015 11:58:14 AM