Skip to content

<Include>

<Include> reads the file at FileName and writes its raw contents into the form's output stream. Use it to share a common header, footer, disclaimer, or HTML block across multiple forms — change the file once and every form that includes it picks up the change.

Use sparingly

Each <Include> is a separate disk read every time the form renders. For most forms, one or two includes is fine. If you find yourself including the same fragment dozens of times in a single form, consider duplicating the markup or extracting it to a <ScriptBlock> (which has a RegisterOnce deduplication option).

Trust the contents

The file is rendered verbatim — no escaping or sanitization. Only include files whose contents you control.

Example

You might keep a site-wide header in ~/includes/CompanyHeader.html:

html
<h1>DNNDev.com</h1>
<p><em>Makers of Cool DNN Tools since 2004</em></p>

Reference it from any form:

html
<AddForm>
  <Include FileName="~/includes/CompanyHeader.html" />
  <table>
    <tr>
      <td>
        <Label For="txtFirstName" Text="First Name" />
        <TextBox Id="txtFirstName" DataField="FirstName" DataType="String" />
      </td>
    </tr>
    ...
    <tr>
      <td colspan="2"><AddButton Text="Add" /> <CancelButton Text="Cancel" /></td>
    </tr>
  </table>
</AddForm>

If the company name changes, update CompanyHeader.html once and every form that includes it picks up the new value.

Properties

PropertyValuesDefaultDescription
FileName *pathPath to the file whose contents should be included

* Required property

Property Details

  • FileName: A path to a file on the web server. Use a tilde (~) prefix for paths relative to the site root, or an absolute virtual path. Examples:

    FormExample
    Tilde (site root)~/includes/CompanyHeader.html
    Absolute virtual path/Portals/0/myfile.txt

    The contents are written verbatim — there is no processing of XMP tags, tokens, or markup inside the included file.