TextBox
TextBox Example
+ =
@inherits ControlComponent
<p>
<asp.TextBox @ref="this.value1" ID="Value1" Columns="2" MaxLength="3" Text="1" />
+
<asp.TextBox @ref="this.value2" ID="Value2" Columns="2" MaxLength="3" Text="1" />
=
<asp.Label @ref="this.answerMessage" />
</p>
<p>
<asp.Button Text="Add" OnClick="this.AddButton_Click" />
</p>
<p>
<asp.RequiredFieldValidator ID="Value1RequiredValidator" ControlToValidate="Value1"
ErrorMessage="Please enter a value.<br />" Display="ValidatorDisplay.Dynamic" />
<asp.RequiredFieldValidator ID="Value2RequiredValidator" ControlToValidate="Value2"
ErrorMessage="Please enter a value.<br />" Display="ValidatorDisplay.Dynamic" />
<asp.RangeValidator ID="Value1RangeValidator" ControlToValidate="Value1"
Type="ValidationDataType.Integer" MinimumValue="1" MaximumValue="100" Display="ValidatorDisplay.Dynamic"
ErrorMessage="Please enter an integer <br /> between than 1 and 100.<br />" />
<asp.RangeValidator ID="Value2RangeValidator" ControlToValidate="Value2"
Type="ValidationDataType.Integer" MinimumValue="1" MaximumValue="100" Display="ValidatorDisplay.Dynamic"
ErrorMessage="Please enter an integer <br /> between than 1 and 100.<br />" />
</p>
@code {
private TextBox value1;
private TextBox value2;
private Label answerMessage;
protected void AddButton_Click(object sender, EventArgs e)
{
int answer;
answer = Convert.ToInt32(value1.Text) + Convert.ToInt32(value2.Text);
answerMessage.Text = answer.ToString();
}
}
TextBox Metadata
Name | Type | Kind |
---|---|---|
AccessKey | String | Parameter |
Attributes | IReadOnlyDictionary | Parameter |
AutoCompleteType | AutoCompleteType | Parameter |
AutoPostBack | Boolean | Parameter |
BackColor | String | Parameter |
BorderColor | String | Parameter |
BorderStyle | BorderStyle | Parameter |
BorderWidth | String | Parameter |
CausesValidation | Boolean | Parameter |
ClientIDMode | ClientIDMode | Parameter |
Columns | Int32 | Parameter |
CssClass | String | Parameter |
Enabled | Boolean | Parameter |
FontBold | Boolean | Parameter |
FontItalic | Boolean | Parameter |
FontNames | String | Parameter |
FontOverline | Boolean | Parameter |
FontSize | String | Parameter |
FontStrikeout | Boolean | Parameter |
FontUnderline | Boolean | Parameter |
ForeColor | String | Parameter |
Height | String | Parameter |
ID | String | Parameter |
MaxLength | Int32 | Parameter |
ReadOnly | Boolean | Parameter |
Rows | Int32 | Parameter |
Style | String | Parameter |
TabIndex | Int16 | Parameter |
Text | String | Parameter |
TextMode | TextBoxMode | Parameter |
ToolTip | String | Parameter |
ValidationGroup | String | Parameter |
Visible | Boolean | Parameter |
Width | String | Parameter |
Wrap | Boolean | Parameter |
OnDataBinding | EventHandler | Event |
OnDisposed | EventHandler | Event |
OnInit | EventHandler | Event |
OnLoad | EventHandler | Event |
OnPreRender | EventHandler | Event |
OnTextChanged | EventHandler | Event |
OnUnload | EventHandler | Event |