How Code Generation Tags Work

Web designers create custom HTML Layout Pages and insert code generation tags in locations where databound controls will be inserted.  Then, use the Page Properties dialog to specify the type of data being displayed and other properties for the tag.  The Page Properties dialog saves the settings in a properties file.  This HTML layout page file and the properties file are used as input to the Iron Speed Designer to produce ASP.NET code.

The code generation tags will be replaced with one or more Presentation Layer Control Tags in the ASPX or ASCX files generated by Iron Speed Designer.  For example, a GEN:IMAGEBUTTON tag is replaced with ASP.NET Presentation Layer control tags to support an action that will be taken when the button is pressed.

Code Generation tag:

<GEN:ImageButton Name=”PlaceOrder”/>

Presentation Layer Control Tag:

<BaseClasses:ImageButton runat="server" id="MyImageButton" CausesValidation="True"

              CommandName="Redirect"

              Consumers="None"

              ImageURL="/images/PlaceOrder.gif"

              RedirectURL="/Pages/ConfirmOrder.aspx"

              ToolTip="Press this button to place your order.">

</BaseClasses:ImageButton>

Some code generation tags specify complex layout and functionality.  For example, to edit the value of a field in a database table, you need only specify GEN:FieldValue tag.  Iron Speed Designer automatically replaces this tag with a text box control and several controls that specify the validation that is required for this field.  For example, the field may be a required field – in which case, a RequiredFieldValidator is also generated. In this case, the number of Presentation Layer control tags generated would be more than one tag to replace one code generation tag.

Code Generation Tag:

<GEN:FieldValue Name=”LastName” Type=”TextBox”/>

Presentation Layer Control Tags:

<BaseClasses:FieldValueTextBox runat="server" id="LastName"

              Field="LastName" Columns="25" CssClass="field_input">

</BaseClasses:FieldValueTextBox>

 

<BaseClasses:RequiredFieldValidator runat="server" id="LastNameRequiredFieldValidator"

              ControlToValidate="LastName" Enabled="False" ErrorMessage="LastName value is required.">

</BaseClasses:RequiredFieldValidator>

 

<BaseClasses:TextBoxMaxLengthValidator runat="server" id="LastNameTextBoxMaxLengthValidator"

              ControlToValidate="LastName" ErrorMessage="Value for LastName is too long.">

</BaseClasses:TextBoxMaxLengthValidator>

 

<BaseClasses:FieldValueValidator runat="server" id="LastNameFieldValueValidator"

              ControlToValidate="LastName" ErrorMessage="Invalid value for LastName.">

</BaseClasses:FieldValueValidator>

 

<BaseClasses:RecordControlCustomValidator runat="server"

              id="LastNameRecordControlCustomValidator"

              ControlToValidate="LastName" ErrorMessage="Invalid value for LastName.">

</BaseClasses:RecordControlCustomValidator>

Code generation tags are also embedded into page template files that define one or more templates for the generation of an application. The page template files are described elsewhere in this Application Developer’s Guide.

Optional Properties

Code generation tags that are not bound to valid data sources are ignored when you display the ASPX pages or ASCX controls.  This enables you to iteratively refine your user interface pages without having to worry about specifying everything in detail.  In most cases, a brief message within an HTML comment is generated for each code generation tag that is not bound.  You can view these messages by opening the ASPX/ASPX file in any editor or view them by selecting View Source from any browser.

See Also

Creating HTML Layout Pages

Code Generation Tags in Layout Pages

Code Generation Tag Syntax