AJAX Email : More DotNetNuke Microsoft ASP.NET AJAX Functionality (VB & C#)

DotNetNuke 4.5.2 brings additional Microsoft ASP.NET AJAX functionality. This will be demonstrated using a simple module that allows you to search among the users of a DotNetNuke portal (using a re-usable .ascx control) and send them an email message. All operations will be achievable without any post backs.

The source code is available in both VB and C# at the end of this article.

Also see:

New DotNetNuke Microsoft ASP.NET AJAX Features

WrapUpdatePanelControl AJAX enhancement

This allows you to easily take any control on the page and have it wrapped by an UpdatePanel. 

In the AJAX Email example, the send email section is placed on a Panel Control that is given the ID pnlEmail.

DotNetNuke.Framework.AJAX.WrapUpdatePanelControl is used to wrap the panel in an Microsoft ASP.NET AJAX UpdatePanel:

VB:

            If DotNetNuke.Framework.AJAX.IsInstalled Then
                DotNetNuke.Framework.AJAX.RegisterScriptManager()
                DotNetNuke.Framework.AJAX.WrapUpdatePanelControl(pnlEmail, True)
            End If

C#:
           if (DotNetNuke.Framework.AJAX.IsInstalled())
            {
                DotNetNuke.Framework.AJAX.RegisterScriptManager();
                DotNetNuke.Framework.AJAX.WrapUpdatePanelControl(pnlEmail, true);
            }

RegisterPostBackControl AJAX enhancement

This allows for exclusions of controls from UpdatePanel async processing. This was implemented in the UrlControl to prevent partial rending when uploading files (stream operations do not work with partial rendering).

In the AJAX Email example, the button labeled Post Back actually performs a post back while all the other controls in the pnlEmail Panel do not. DotNetNuke.Framework.AJAX.RegisterPostBackControl is used to implement this functionality. Below is the complete implementation for this feature:

VB:

            If DotNetNuke.Framework.AJAX.IsInstalled Then
                DotNetNuke.Framework.AJAX.RegisterScriptManager()
                DotNetNuke.Framework.AJAX.WrapUpdatePanelControl(pnlEmail, True)
                DotNetNuke.Framework.AJAX.RegisterPostBackControl(btnPostBack)
            End If

C#:
           if (DotNetNuke.Framework.AJAX.IsInstalled())
            {
                DotNetNuke.Framework.AJAX.RegisterScriptManager();
                DotNetNuke.Framework.AJAX.WrapUpdatePanelControl(pnlEmail, true);
                DotNetNuke.Framework.AJAX.RegisterPostBackControl(btnPostBack);
            }

CreateUpdateProgressControl AJAX enhancement

This creates an update progress control. This was implemented in Skin.vb so that the update progress control is automatically injected by the framework for modules which support partial rendering.

If you go into module definitions and set the Survey.ascx control (for the Survey module) to Support Partial Rendering...

A progress indicator will now appear and the page will refresh without a post back.

UpdatePanelUpdateModeType AJAX enhancement.

This was necessary in order to set the UpdatePanel.UpdateMode to Conditional - which is now the default (it was mistakenly set to All in the previous version).

In the previous version of DotNetNuke, when a Progress Control was triggered, all Progress Controls on the page triggered. This has now been corrected.

Source Code:

Download the code: AJAX Email 01.00.00 (VB) / (C#)

[Back to: The ADefWebserver DotNetNuke HELP WebSite]

 


Buy DotNetNuke Modules from Snowcovered

 DotNetNuke Powered!DotNetNuke is a registered trademark of DotNetNuke Corporation.