C# Functions

Using C# Functions

You can use both inline and external C# functions as any other CMS functions. You can insert them on pages or page templates. You can make function calls to them from, or use them in templates of, XSLT functions. You can use C# functions to set values of input parameters and data fields.

Please note that on pages you can use C# functions when switched to the Source view. To learn to make them available in Visual Editor, too, please see “Integrating with Visual Editor”.

To use a C# function on a page:

  1. In Content, select a page and click Edit Page.
  2. Switch to Source.
  3. Place the cursor where you want the function inserted.
  4. Click Insert > Function Markup.
  5. In the Select Function window, expand All Functions, namespaces, select the function and click OK.

    Figure 20: Inserting a C# function on a page (Source view)

  6. In the Function properties window, set the function’s parameters if required and click OK.

The function will appear on a page.

Figure 21: A C# function inserted on a page (Visual view)

In the same manner, you can insert C# function in page templates and XSLT functions.

Please also see “How to Use Functions“ in the “Guide to CMS Functions”.