Click or drag to resize
KaxInputControlAutoPostBack Property
Gets or sets a value indicating whether an automatic post back to the server occurs whenever the user presses the ENTER or the TAB key while in the KaxInput control.

Namespace: Kettic.AspNet.Controls
Assembly: Kettic.AspNet.Controls (in Kettic.AspNet.Controls.dll) Version: 2014.4.1129.0 (2014.04.1129.0)
Syntax
public virtual bool AutoPostBack { get; set; }

Property Value

Type: Boolean
true if an automatic postback occurs whenever the user presses the ENTER or the TAB key while in the KaxInput control; otherwise, false. The default is false.
Remarks
Use the AutoPostBack property to specify whether an automatic post back to the server will occur whenever the user presses the ENTER or the TAB key while in the KaxInput control.
Examples

The following code example demonstrates how to use the AutoPostBack property to automatically display the sum of the values entered in the KaxTextBoxes when the user presses the ENTER or the TAB key.

[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 Page_Load(Object sender, EventArgs e)
{
int Answer;

// Due to a timing issue with when page validation occurs, call the
// Validate method to ensure that the values on the page are valid.
Page.Validate();

// Add the values in the text boxes if the page is valid.
if(Page.IsValid)
{
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 />
The two values are automatically added
<br />
when you tab out of the text boxes.
<br />
</td>
</tr>
<tr>
<td colspan="5">

</td>
</tr>
<tr align="center">
<td>
<kaxI:KaxTextBox ID="Value1" Columns="2" MaxLength="3" AutoPostBack="True" Text="1" runat="server" />
</td>
<td>
+
</td>
<td>
<kaxI:KaxTextBox ID="Value2" Columns="2" MaxLength="3" AutoPostBack="True" 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 />" EnableClientScript="False" 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 />"
EnableClientScript="False" Display="Dynamic" runat="server" />
</td>
<td colspan="2">
<asp:RequiredFieldValidator ID="Value2RequiredValidator" ControlToValidate="Value2"
ErrorMessage="Please enter a value.<br />" EnableClientScript="False" 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 />"
EnableClientScript="False" Display="Dynamic" runat="server" />
</td>
<td>
&nbsp
</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 Page_Load(sender As Object, e As EventArgs)

Dim Answer As Integer

' Due to a timing issue with when page validation occurs, call the
' Validate method to ensure that the values on the page are valid.
Page.Validate()

' Add the values in the text boxes if the page is valid.
If Page.IsValid Then

Answer = Convert.ToInt32(Value1.Text) + Convert.ToInt32(Value2.Text)

AnswerMessage.Text = Answer.ToString()

End If

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 />
The two values are automatically added
<br />
When you tab out of the text boxes.
<br />
</td>
</tr>
<tr>
<td colspan="5">

</td>
</tr>
<tr align="center">
<td>
<kaxI:KaxTextBox ID="Value1" Columns="2" MaxLength="3" AutoPostBack="True" Text="1" runat="server" />
</td>
<td>
+
</td>
<td>
<kaxI:KaxTextBox ID="Value2" Columns="2" MaxLength="3" AutoPostBack="True" 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 />" EnableClientScript="False" 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 />"
EnableClientScript="False" Display="Dynamic" runat="server" />
</td>
<td colspan="2">
<asp:RequiredFieldValidator ID="Value2RequiredValidator" ControlToValidate="Value2"
ErrorMessage="Please enter a value.<br />" EnableClientScript="False" 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 />"
EnableClientScript="False" Display="Dynamic" runat="server" />
</td>
<td>
&nbsp
</td>
</tr>
</table>
</form>
</body>
</html>
See Also