Exploring the depths and potentials of ASP.NET RSS 2.0 or Subscribe to .BenRush by Email
 Thursday, August 16, 2007

                The UpdatePanelAnimationExtender is an interesting and useful extender control found in the ASP.NET AJAX Control Toolkit that enables you to run animations when an UpdatePanel control updates or has finished updating on the client. The sample on the control toolkit website shows how you can animate the UpdatePanel when it updates by leveraging the extender control.

                However, because the Animation framework is quite extensive, you can also do many interesting things to controls outside of the UpdatePanel when it updates by leveraging a bit of JavaScript and the UpdatePanelAnimationExtender. This is possible without the UpUpdatePanelAnimationExtender, but by using it you can accomplish scripting in a much cleaner and manageable manner. For example, say I wanted to disable a button outside of my UpdatePanel when the panel updates:

                To do this with the UpdatePanelAnimationExtender is trivial, you simply add the Extender to your page:

                Note that it has an Animations sub-element; this is where you place the Animations you want ran when the UpdatePanel updates or has finished updating (OnUpdating and OnUpdated respectively).  Now, you can add any animations under the event nodes, but I want to add some script to disable the button and re-enable it when the UpdatePanel has finished refreshing:

                Now your script is clearly and concisely placed within Animation event framework where you can make it invisible, disabled, etc. To me this is a much nicer solution than writing script directly into the page output.

 


kick it on DotNetKicks.com
Thursday, August 16, 2007 9:52:19 AM (Central Standard Time, UTC-06:00)  #    Comments [2] - Trackback
AJAX | ASP.Net | JavaScript | Web 2.0
Thursday, August 16, 2007 2:20:22 PM (Central Standard Time, UTC-06:00)
Hey Ben!

Much better and cleaner - it's working.

Questions: OnUpdating and OnUpdated - is there documentation on what else is available?
and
How elaborate can your script get? What if I wanted to include an 'if' condition - is that possible?

Thanks
Mike
Sunday, August 19, 2007 9:24:12 AM (Central Standard Time, UTC-06:00)
The script can be as advanced as you like. Try defining a script method outside of the XML and calling it from the script event handlers, this is a much better way than writing a bunch of script on a single line.

Also, the updates OnUpdating and OnUpdated are the only events currently supported by this particular control.
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

Live Comment Preview

Computers Blogs - Blog Top Sites

Archive
<August 2008>
SunMonTueWedThuFriSat
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456
Blogroll
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008
Benjamin Rush
Sign In
Statistics
Total Posts: 444
This Year: 0
This Month: 0
This Week: 0
Comments: 127
Themes
Pick a theme:
All Content © 2008, Benjamin Rush
DasBlog theme 'Business' created by Christoph De Baene (delarou)