An Introduction to Power Pages

How Can We Help?

< Back

Version 6.7 of the XMPro Action Hub supports Power Pages. The following is a breakdown of what they are and how to use them.

What are Power Pages

Power pages are ASP.NET Web Forms (i.e .aspx pages) that live within the XMPro ecosystem. They provide an avenue for developers to build pages that harness features of ASP.NET that cannot be controlled from within the XMPro Process Designer.

Some examples of use cases:

  • Pages that load a large amount of data in grids, or that have multiple grids

Having control over exactly when data grids bind to their datasource can greatly improve performance on pages that load large volumes of data or have a large number of grids.

  • Pages that require partial/selective updating of sections (e.g. fields, grids or charts)

Using Callbacks (as supported by many DevExpress controls) to selectively update controls or sections of a page reduces how much data travels back to the browser and results in quicker updates to the page.

If you combine this with reduced ViewState usage (setting EnableViewState=false on controls), you can further speed up the server roundtrip.

  • Pages that need to make use of controls or configuration settings that are not available via the Process Designer

Sometimes a specific DevExpress control can greatly improve the performance and usability of a page or allow you to more closely meet a customer requirement. Power Pages allow you to access the full library of DevExpress controls (and all their configuration options).

Caveats of using Power Pages

  • Power Pages don’t currently generate an audit history, so are currently best suited for read-only pages such as reports/dashboards. If changes are being made from a power page then the actions should be logged/tracked via custom logic and reporting.
  • Power Pages require developer-level C# and ASP.Net Web Forms skills. In addition to that, knowledge of the DevExpress control set for ASP.Net will be useful (DevExpress provide extensive documentation for their controls on their site).

Anatomy of a Power Page

A Power Page consists of two files:

  1. A markup (.aspx) file containing the XHTML markup for the page
  2. A code (.aspx.cs) file containing the C# code for the page

Both of these files will need to be deployed to the XMPro Action Hub instance.

Getting started with Power Pages

The following steps will take you through creating your first power page.

1. Create a new markup (.aspx) file, we’ll call it MyFirstPowerPage.aspx, and set it up with the following markup:

<%@ Page Title="My First Power Page" Language="C#" 
AutoEventWireup="true" CodeFile="MyFirstPowerPage.aspx.cs"
Inherits="MyProject.MyFirstPowerPage" %>
<asp:Content ID="Main" ContentPlaceHolderID="MainContent" runat="server">
     <div class="tbDetail">
          <div class="taskheading">
               <table><tr><td>
                    <asp:Label id="lblName" runat="server"></asp:Label>
               </td></tr></table>
          </div>
          <!-- Your content goes here-->
      </div>
</asp:Content>

Note: The <%@ Page %> directive at the top of the page uses the CodeFile attribute and not the CodeBehind attribute. This ensures that any changes to the code (.aspx.cs) file will be recompiled at runtime.*

2. Create a new code (.aspx.cs) file, MyFirstPowerPage.aspx.cs, and set it up with the following code snippet:

using System;
using System.Web.UI.WebControls;
using XMPro.XMServer;

namespace MyProject
{
   public partial class MyFirstPowerPage : XMPro.XMWorkspace.BasePage
{
     /// <summary>
     /// Use this event for the following:
     /// - Check the IsPostBack property to determine whether this is the first time the page is being processed.
     /// The IsCallback and IsCrossPagePostBack properties have also been set at this time.
     /// - Set base page properties
     /// </summary>
     protected override void OnPreInit(EventArgs e)
     {
        //Set page master
        this.Page.MasterPageFile = XMPro.XMServer.Settings.MasterPage;
        base.OnPreInit(e);
     }

     /// <summary>
     /// Raised after all controls have been initialized and any skin settings have been applied.
     /// The Init event of individual controls occurs before the Init event of the page.
     /// Use this event to read or initialize control properties.
     /// </summary>
     protected override void OnInit(EventArgs e)
     {
        base.OnInit(e);

     //Further initialise other controls here
     lblName.Text = base.Title;
     }

     /// <summary>
     /// The Page calls the OnLoad method on the Page object, and then recursively does the same for
     /// each child control until the page and all controls are loaded.
     /// The Load event of individual controls occurs after the Load event of the page.
     /// Use the OnLoad event method to set properties in controls and to establish database connections.
     /// </summary>
     protected void Page_Load(object sender, EventArgs e)
     {
        if (!Page.IsPostBack && !Page.IsCallback)
        {
          //Do anything here that needs to happen on the first load only
        }
     }
}
}

3. This will create a blank Power Page (as below)

 

 

Deploying your Power Page

Since v6.7, Action Hub provides support for creating and editing Power Pages. It allows you to upload the content of your Power Page files (.aspx & .aspx.cs) and it will deploy the files for you.

For more information, follow these instructions to deploy a Power Page in Action Hub v6.7.

 

 

Comments are closed.

This is the legacy version of the XMPro Documentation site. For the latest XMPro documentation, please visit documentation.xmpro.com

X