Wednesday, March 28, 2012

multiple updatepanel which one is actived javascript

Hi all,

Title says everthing actually. I need to find which update panel is updating at the moment for multiple update panel coding which in one update panel i have coded to update others on the server side conditionally. If i cant find which one is activated is it possible to find which one initiated the update will work too. Thanks

Hi.

You can use UpdateProgress and associated the update panel with AssociatedUpdatePanelID property .

Hopes that help.


If I understand you correctly, you want to know on the client which UpdatePanel(s) were just updated.

If that's right, then take a look at the PageLoaded event on the PageRequestManager:http://ajax.asp.net/docs/ClientReference/Sys.WebForms/PageRequestManagerClass/PageRequestManagerPageLoadedEvent.aspx.

You'll get two parameters passed to your handler... the second is a PageLoadedEventArgs:http://ajax.asp.net/docs/ClientReference/Sys.WebForms/PageLoadedEventArgsClass/default.aspx.

You can use args.get_panelsUpdated() to get an array of <div> elements that were just updated during an async postback.


actually both answers are not what I'm looking for if i read correctly. First i don't have UpdateProgress i use an generic modal that's called all over the place with out caller information. Its a function that shows please wait message like pleasewait(true); or false soAssociatedUpdatePanelID wont work since i don't have one.

And for your suggestion if i read this right, it works right after the update is ended, I need it while its working so i know if i want to abort it or not. Since one of the update is crucial not to stop, one is not crucial. So when i give them option to stop it should only stop if its not crucial. (if that make sense)

Im not sure but im going to try to set an hidden field with a value right when the update starts but didnt have time to test this one yet.


So you're looking to see what control is causing the update? (As opposed to which panels will be updated.)


no no i am look looking for which update panel is getting updated but i need to know it before or while the server side is getting called, like lets say we have updatepanel1, panel2 and panel3

they all call pleasewait(true) function to start the please wait modal window

I show a cancel button here but i only want this cancel button to work for updatepanel1 so need is it the panel one activing the please wait or panel2 or 3, so using the info i can disable the cancel button.

I hope that make sense.


But from your first post, aren't you making the decision about which UpdatePanels to update on the server? If so, there's no way to know on the client which panels will be updated, since that hasn't been decided yet.

In general, even if you're not doing anything explicit on the server (just using Triggers), all you can know on the client is which control is posting back. You won't know until the postback finishes which panels actually get updated.


Steve Marx:

But from your first post, aren't you making the decision about which UpdatePanels to update on the server? If so, there's no way to know on the client which panels will be updated, since that hasn't been decided yet.

Thats ok, i tought it would be the same tooo. So is possible to tell the second part of my question

drewex:

If i cant find which one is activated is it possible to find which one initiated the update will work too

As long as i can find which one initiates the update i think i can make this work.


I'll add one more thing there are iframes that i use in this page which can call the please wait too. So i need to seperate those too. But if there is not updatepanel update initiated that means iframe called it. so i can give cancel option or not. I hope im making some sense.

No comments:

Post a Comment