Click here to Skip to main content
15,917,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to move my cursor from one to another text box on keypress event how it can be solved.please help me thnx in advance
Posted
Comments
Shelby Robertson 18-Jul-12 9:34am    
Are you trying to move from one textbox to the next one like you would if you hit tab? Or are you trying to go from a specific textbox to a different specific textbox? Posting the relevant HTML would help.
[no name] 18-Jul-12 9:42am    
i want to move from any one to another textbox

1 solution

ASP.NET
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="javascript">
function Tab()
{
    var tb1=document.getElementById("<%=TextBox2.ClientID%>");
        tb1.focus();
}

</script>
</head>
<body >
    <form id="form1" runat="server">
    <asp:TextBox ID="TextBox1" runat="server" onkeypress="return Tab();"></asp:TextBox>
    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
    </form>
</body>
</html>
 
Share this answer
 
v2

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



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