<Text>
The Text tag renders the value of a column from a <SelectCommand> as plain, unwrapped text — there's no surrounding <span> or other element. Use it to display read-only data inside your form's HTML or to inject a value into JavaScript.
One-way binding
The Text tag is one-way bound. It receives data from a <SelectCommand> but does not participate in <SubmitCommand> — its value is never saved back to the database.
Example
Display a value inline with your HTML:
<strong>Last Login Date: <Text DataField="LastLogin" /></strong>Inject a value into JavaScript:
<AddForm>
<a href="#" onclick="alert('<Text DataField='LastLogin'/>')">Click for Last Login Date</a>
<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>Properties
| Property | Values | Default | Description |
|---|---|---|---|
| DataField | string | Name of the column from the form's <SelectCommand> whose value should be rendered | |
| Nullable | True False | False | When the bound value is DBNull, render as an empty string |
No styling properties
Because the Text tag renders only the value — with no surrounding HTML element — properties like CssClass, Style, Width, Height, and the deprecated ASP.NET style properties have no effect. To style the text, wrap the tag in your own HTML element.
Property Details
DataField: Name of the column from the form's
<SelectCommand>whose value should be rendered. Unlike most form controls, the Text tag is one-way bound and does not need a corresponding parameter in<SubmitCommand>— it never sends data back to the database.Nullable: When the bound value from the database is DBNull, the rendered output will be an empty string rather than the literal text "DBNull".