KaxInputControlText Property |
Namespace: Kettic.AspNet.Controls
Use the Text property to specify or determine the text displayed in the KaxInput control. To limit the number of characters accepted by the control, set the MaxLength property. If you want to prevent the text from being modified, set the ReadOnly property.
The value of this property, when set, can be saved automatically to a resource file by using a designer tool.
The following code example demonstrates how to use the Text property to specify the text displayed in the KaxTextBox control.
[C#]
</%@ Page Language="C#" AutoEventWireup="True" /%>
</%@ Register Assembly="KaxInput.Net2" Namespace="Kettic.AspNetControls" TagPrefix="kaxI" /%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>KaxTextBox Example </title>
<script runat="server">
protected void AddButton_Click(object sender, EventArgs e)
{
int Answer;
Answer = Convert.ToInt32(Value1.Text) + Convert.ToInt32(Value2.Text);
AnswerMessage.Text = Answer.ToString();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<h3>
KaxTextBox Example
</h3>
<table>
<tr>
<td colspan="5">
Enter integer values into the text boxes.
<br />
Click the Add button to add the two values.
<br />
Click the Reset button to reset the text boxes.
</td>
</tr>
<tr>
<td colspan="5">
</td>
</tr>
<tr align="center">
<td>
<kaxI:KaxTextBox ID="Value1" Columns="2" MaxLength="3" Text="1" runat="server" />
</td>
<td>
+
</td>
<td>
<kaxI:KaxTextBox ID="Value2" Columns="2" MaxLength="3" Text="1" runat="server" />
</td>
<td>
=
</td>
<td>
<asp:Label ID="AnswerMessage" runat="server" />
</td>
</tr>
<tr>
<td colspan="2">
<asp:RequiredFieldValidator ID="Value1RequiredValidator" ControlToValidate="Value1"
ErrorMessage="Please enter a value.<br />" Display="Dynamic" runat="server" />
<asp:RangeValidator ID="Value1RangeValidator" ControlToValidate="Value1" Type="Integer"
MinimumValue="1" MaximumValue="100" ErrorMessage="Please enter an integer <br /> between than 1 and 100.<br />"
Display="Dynamic" runat="server" />
</td>
<td colspan="2">
<asp:RequiredFieldValidator ID="Value2RequiredValidator" ControlToValidate="Value2"
ErrorMessage="Please enter a value.<br />" Display="Dynamic" runat="server" />
<asp:RangeValidator ID="Value2RangeValidator" ControlToValidate="Value2" Type="Integer"
MinimumValue="1" MaximumValue="100" ErrorMessage="Please enter an integer <br /> between than 1 and 100.<br />"
Display="Dynamic" runat="server" />
</td>
<td>
 
</td>
</tr>
<tr align="center">
<td colspan="4">
<asp:Button ID="AddButton" Text="Add" OnClick="AddButton_Click" runat="server" />
</td>
<td>
</td>
</tr>
</table>
</form>
</body>
</html>
[Visual Basic]
</%@ Page Language="VB" AutoEventWireup="True" /%>
</%@ Register Assembly="KaxInput.Net2" Namespace="Kettic.AspNetControls" TagPrefix="kaxI" /%>
<!DOCTYPE html Public "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>KaxTextBox Example </title>
<script runat="server">
Protected Sub AddButton_Click(sender As Object, e As EventArgs)
Dim Answer As Integer
Answer = Convert.ToInt32(Value1.Text) + Convert.ToInt32(Value2.Text)
AnswerMessage.Text = Answer.ToString()
End Sub
</script>
</head>
<body>
<form id="form1" runat="server">
<h3>
KaxTextBox Example
</h3>
<table>
<tr>
<td colspan="5">
Enter Integer values into the text boxes.
<br />
Click the Add button To add the two values.
<br />
Click the Reset button To reset the text boxes.
</td>
</tr>
<tr>
<td colspan="5">
</td>
</tr>
<tr align="center">
<td>
<kaxI:KaxTextBox ID="Value1" Columns="2" MaxLength="3" Text="1" runat="server" />
</td>
<td>
+
</td>
<td>
<kaxI:KaxTextBox ID="Value2" Columns="2" MaxLength="3" Text="1" runat="server" />
</td>
<td>
=
</td>
<td>
<asp:Label ID="AnswerMessage" runat="server" />
</td>
</tr>
<tr>
<td colspan="2">
<asp:RequiredFieldValidator ID="Value1RequiredValidator" ControlToValidate="Value1"
ErrorMessage="Please enter a value.<br />" Display="Dynamic" runat="server" />
<asp:RangeValidator ID="Value1RangeValidator" ControlToValidate="Value1" Type="Integer"
MinimumValue="1" MaximumValue="100" ErrorMessage="Please enter an integer <br /> between than 1 and 100.<br />"
Display="Dynamic" runat="server" />
</td>
<td colspan="2">
<asp:RequiredFieldValidator ID="Value2RequiredValidator" ControlToValidate="Value2"
ErrorMessage="Please enter a value.<br />" Display="Dynamic" runat="server" />
<asp:RangeValidator ID="Value2RangeValidator" ControlToValidate="Value2" Type="Integer"
MinimumValue="1" MaximumValue="100" ErrorMessage="Please enter an integer <br /> between than 1 and 100.<br />"
Display="Dynamic" runat="server" />
</td>
<td>
 
</td>
</tr>
<tr align="center">
<td colspan="4">
<asp:Button ID="AddButton" Text="Add" OnClick="AddButton_Click" runat="server" />
</td>
<td>
</td>
</tr>
</table>
</form>
</body>
</html>