Click here to Skip to main content
14,971,029 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
function move(field,nextFieldID)
{
  if(field.value.length >= field.maxLength)
  {
    document.getElementById(nextFieldID).focus();
  }
}


=====================================================================
ASP.NET
<asp:TextBox ID="T1" runat="server" MaxLength="3" onkeyup="move(this,'T2')">
<asp:TextBox ID="T2" runat="server" MaxLength="3" onkeyup="move(this,'T3')">
<asp:TextBox ID="T3" runat="server" MaxLength="3" onkeyup="move(this,'T1')">


=====================================================================

OnKeyUp is not working with TextBox. Even tried this too but none works for me.
C#
T1.Attributes.Add("onkeyup", "move(this,' " + T2.ClientID + " ')"); 

Plz help me out.
Thanks in Advance.
Posted
Updated 18-Mar-12 3:45am
v3
Comments
ProEnggSoft 18-Mar-12 9:46am
   
Edit: pre tags and code tags added - PES
ZurdoDev 19-Mar-12 8:20am
   
What does happen? Have you viewed the source of your page to make sure that when your code is generated the client id is also T1? If this is in a user control or if the page is on a master page it may no longer be named T1.
Sanjeev236 20-Mar-12 7:01am
   
no its nt a master page.
Vijay Walunj,Navi mumbai 10-May-12 5:27am
   
Close the textbox tag.i have tried your code it works. check for the is there any error in your rest of the javascript code.It may causes functionality of other code.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900