Developer Guide
ActivePages Properties and Features

    Active Pages bring you a wealth of features and tools to be able to create new user-interfaces. Within Active Pages, you can access certain properties and global variables to reference user information, company preferences, user's device information and so on. Active Pages use the ASP.NET expression language to evaluate and provide access to these values (anything that is placed inside <% %>.

    An example of accessing and printing out the user's name is below:



    There are three supported accessors that are used with the above merge field indicators:

    // = (Equal sign) - prints the value to the page without HTML encoding
    // : (Colon sign) - HTML encodes and then prints the value to the page 
    // # (Number sign) - Used only for binding values into Component properties
    <aspx:ViewHeader runat='server' visible='<%#Bool(DataBag.IsVisible)%>'/>

    AppNamestringProvides the name of the current Custom Portal or Site name as determined in the Company Preferences.

    The name of the Current Action.


    Special object container that holds all values loaded into it.

    IsMobileboolReturns true if the user's device is a mobile phone or a tablet.
    IsTabletboolReturns true if the user's device is a tablet.
    ModelobjectThe main object that is passed from the Controller to the Page.
    UserDeviceDeviceInfoProvides device details about user's target device.
    UserInfoUser (entity object)Returns the current user's information.
    SystemInfoobjectProvides access to many system resources such as Current User, Preferences, Current Custom Portal and more.


    <aspx:AspxPage runat='server'>




    Format String Values

    <%:Format("{0} says hi!", UserInfo.Name)%>

    Format Currency

    This method formats a value as a Currency string using the Organization's currency symbol. You can alternatively provide the three-letter ISO currency code of the target currency for proper formating.

    //Amount value is: 400, organization currency is USD, outputs: $500 
    //Specify the ISO Code for a different currency, outputs: €500
    <%=FormatCurrency(Model.Amount+100, "EUR");

    Format Address

    This method formats the Street, City, State, Postal Code, and Country values. If one or more of these values are not provided, a proper address value will still be outputted.

    <%=FormatAddress(Model.Street, Model.City, Model.State, Model.PostalCode, Model.Country)%>

    Convert values to Boolean

    <aspx:ViewPanel runat='server' title='Edit Contact' visible='<%# Bool(DataBag.IsEditMode) %>'>

    Convert values to String

    //converts a value to string and handles null

    Convert values to Decimal

    Convert string, null or other values to decimal when possible.

    <% if (Num(DataBag.Amount)>100) { %>
      <span>Over $100</span>
    <% } %>

    HTML Encode/Decode

    <%:Decode(DataBag.EncodedValue) + Model.Name%>

    HTML Attribute Encode

    It is highly recommended that you encode any dynamic variable in the rendered HTML.

    <a href='/home/index' title='<%=AttributeEncode(DataBag.ItemTitle)%>'>Go to Home</a>

    Working with JSON Strings

    //Escapes all double-quotes in the text, suitable for Json formatting in HTML attributes.
    <a id='itemId' data-value='<%=EscapeDoubleQuotes(DataBag.ScriptString)%>'>Item Name</a>
    //Convert an object to a JSON string
    //Convert JSON string to object
    <%=FromJson(DataBag.ContactInJson, dbObject.GetEntityType("Contact"))%>

    Use Substitute Value

    If the value is null, then use a substitute value.


    Check String Value
    Examine a string to see if it is null, empty or whitespace.

    <% if (IsEmpty(DataBag.String)) { %>
       <span>Value is empty or white-space</span>
    <% } %>

    Current Page URL

    <iframe src='<%=Format("{0}",PageUrl())%>'>

    Building MVC Links

    LinkToAction generates a link to an action on the same controller or alternatively to other controller's action.

    //Link to the same controller
    <a href='<%=LinkToAction("Index")%>'>Home Tab</a>
    //Link to the same controller with extra parameters
    //LinkToAction(string action, string controller, object parameters)
    <a href='<%=LinkToAction("Detail","Contact", new { id="00100000000007I0453" })%>'>Go to Detail page</a>
    //Link to action on a different controller
    <a href='<%=LinkToAction("Create","Force__Account", new { area="force" })%>'>Create a New Account</a> 

    Link to Active Pages

    Generates a link to an ActivePage.

    <aspx:AspxPage runat="server">
            <a href='<%=LinkToActivePage("MyPage")%>'>My Page</a>
            <!-- link to active page with parameters -->
            <a href='<%=LinkToActivePage("MyPage", new { id=Model.Id })%>'>Link to Page</a>