|
Go to: |
Tools, Properties..., Display tab |
The Label control displays a database field label.
|
|
Label and Literal control options. |
|
Options |
Description |
||||||
|
Display this when field contains a value |
Formats text to be displayed on the web page. Any text and HTML may be included, such as HTML formatting tags. {0} is a substitution variable that signifies the database value. See Conditional field value display for details. |
||||||
|
Display this text when field is empty |
Specifies the text to be displayed or inserted into the database if the underlying database field has a “null” value (no value). Any text and HTML may be included, such as HTML formatting tags. See Conditional field value display for details. |
||||||
|
White space encoding |
|
||||||
|
Save field value to database |
Sets the "SaveData=True" pass-through attribute value so that any automatically initialized value is saved to the database. (Values in Labels and Literals are not automatically saved to the database, unlike control types normally used for data input, such as text boxes and list boxes). You can initialize field values using the Set Initial Value To properties. See FieldValue Initial Value Properties for details. |
||||||
|
Display text as |
Specifies how to display the text contained in the field.
|
Any combination of text, HTML and the actual database value can be displayed. The following examples illustrate how text, HTML and the database field value can be combined.
|
Display this when field contains a value |
Displays as |
Purpose |
|
{0} |
William |
Displays the database field value. |
|
<font color=”red”>{0}</font> |
William |
Displays the database field value in red. |
|
<a href=”mailto:{0}”>{0}</a> |
bill@ironspeed.com |
Displays a ‘mailto’ email link. The field should contain a valid email address. |
|
<a href=”{0}”>{0}</a> |
www.ironspeed.com |
Displays a clickable URL (hyperlink) from the database. The field should contain a valid URL. |
|
<a href=”{0}” target=”_blank”>{0}</a> |
www.ironspeed.com |
Displays a clickable URL (hyperlink) from the database. The field should contain a valid URL. When clicked, a new browser window is opened with the hyperlinked page. |
|
<a href=”http://www.ironspeed.com/kb?q={0}”> |
Search for William |
Displays a clickable URL (hyperlink) as part of a query string. The field should contain a valid URL. |
|
<img src="{0}" /> |
|
Displays an image if the field contains a valid URL. |
The conditional display feature is frequently used to display ‘not available’ or ‘image not found’ when fields are emplty. The example below illustrates how an image can be displayed from the database field containing a URL. If the field is empty, a ‘no image available’ default image is displayed instead.
Step 1: Set the Control Type to ‘Literal’ to enable the conditional display feature. Conditional display is available for the Label and Literal control types.
Step 2: Use an <img> tag to display an image using the URL stored in the database field.
Step 3: Use an <img> tag to display a default ‘no image available’ image when the database field is empty, i.e., it does not contain a URL.

The conditional display feature can be used to display hyperlinked (clickable) URLs if your database field contains a URL.
Step 1: Set the Control Type to ‘Literal’ to enable the conditional display feature.
Step 2: Use an <a href> tag to display a clickable URL using the URL stored in the database field.

Step 3: Build and run your application.
If the database field only contains a page or file name and not a fully qualified URL, the <a href> tag can be expanded to add a prefix to the location containing the file, e.g.:
<a href=”http://www.ironspeed.com/{0}”>{0}</a>
You can open the hyperlinked page in a new browser window by providing a “target” attribute, e.g.:
<a href=”{0}” target=”_blank”>{0}</a>
When displaying fields as ‘rich text’ it is common for records with smaller amounts of text to be displayed as rich text and for records with larger amounts text to be truncated and displayed in the browser font because there isn’t sufficient room to display them as rich text. This can lead to a situation where the fonts in certain table cells differ markedly. Most likely your field is set to show text as Default, allowing the Application Generation Options to decide how to display the text. If set to Display text as ‘Rich text’ and the threshold is low enough that this field qualifies to use rich text, then any cell in this column where text fits completely will be shown as a rich text; any cell where the text length exceeds the cell width will be truncated and displayed in the default browser font.
To show all text using the same font, you can do one of the following:
Increase the cell size in the Application Generation Options to fit the entire text into the cell. While this will enlarge many table rows, all text will be displayed as rich text.
Set the Application Generation Options to show text as 'HTML source' and rebuild the application. The text will be displayed as regular text and not as rich text. However, embedded HTML tags in the rich text will be displayed as raw HTML tags and not rendered.
Set the particular field to show as ‘HTML source’ in the Properties for the field. The text will be displayed as regular text and not as rich text.
Increase the size of the FieldMaxLength pass-through attribute to exceed the length of the contents stored in the field or the length of the database field itself. See FieldValue Pass-Through Attributes for details.
Don't use the rich text editor option (FCKEditor) to enter text. Use the ASP.NET multi-line text control instead. You can choose between the two either globally via the Application Generation Options dialog or on a field-by-field basis via the Properties dialog. Of course, with this option you won't have any HTML text formatting either.
Write a code customization that strips out the embedded HTML for display purposes. All text, regardless of length will be displayed in the default browser font.
FieldValue Control Type Properties
FieldValue Display Format Properties
Label and Literal Control Options
File Upload and File Download Control Options
FieldValue Initial Value Properties
FieldValue Pass-Through Attributes