ASP.NET Ajax UpdatePanelNotifier Builtin Effects
Yesterday I wrote about a control I've written which lets you bind javascript functions to UpdatePanel's partial postbacks. I've been working on it some more today and I enhanced it with some builtin effects which can be applied to the UpdatePanel which is refreshed using the combination effects of the script.aculo.us library. The behavior is similar to the UpdatePanelAnimation control extender which can be found in the AjaxControlToolkit but this is easier to use and more flexible in that only the UpdatePanel which is actually refreshed is applied the effect. Furthermore using the Animation framework available with the toolkit can be tricky.
The control API becomes:
- OnBeginRequest and OnEndRequest properties: enum of type ClientAction
- CustomBeginRequest and CustomEndRequest properties: string which accepts the name of a javascript function declared in the page
The ClientAction enum defines the following values:
- Custom
- Appear
- Fade
- ... [all the script.aculo.us combination effects]
The behavior is as following:
- When an effect is specified via the OnBeginRequest and OnEndRequest properties the corresponding effect is applied to the UpdatePanel which is being refreshed during the corresponding event
- When the value of one of those properties is set to Custom you can specify via the CustomBeginRequest and/or CustomEndRequest properties the name of a custom javascript function declared in your page which is called in response to the correspondng event (the function accepts as input parameter an DOM element which is the DIV element of the UpdatePanel as rendered in the browser).
- If you don't want to do anything just set OnxxxRequest to Custom and leave the corresponding CustomxxxRequest empty.
The source code is available on
my main project's svn repository.