You may want to auto set the focus to the next textbox, when the user has typed the exact length in the current textbox.
Telephone number: (012)-(12345678)
The max length for the first textbox is 3, after user typed in "012" which already reached the max length, the the focus should automatically set to the next text box.
Thanks for my colleague, Carmen, who helped me to find the following solution.
Add the following script to the <head> block:
//Set focus to the next Field if the current value reaches its max length
function Tab(currentField, nextField)
// Determine if the current field's max length has been reached.
if (currentField.value.length == currentField.maxLength)
// Retrieve the next field in the tab sequence, and give it the focus.
Copy this function in the code file:
public static void AddNextTabAttribute(TextBox txt1,
//Set next tab attribute when key up
txt1.Attributes.Add("OnKeyUp", "Tab(this, '" +
txt2.ClientID + "')");
Whenever the "KeyUp" event has trigged in the first textbox, it'll call the Tab() function and check if it has reached its max length.
Then, call this function in Page_Load event to add the attributes to the textbox.