Home  »  Code Snippets  »  ASP.Net  »

How to change focus using enter in asp.net

 Posted By : Manoranjan SahooPosted Date : 11/11/2010 05:15:22 PM Category : ASP.Net Points : 3

Sometimes we need to change focus from one control to another control in asp.net page and we have all server control. To achieve that check below code :

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <form id="form1" runat="server">
        <asp:TextBox ID="TextBox1" runat="server" onkeypress="if(event.keyCode=='13')document.form1.TextBox2.focus();"></asp:TextBox>
        <asp:TextBox ID="TextBox2" runat="server" onkeypress="if(event.keyCode=='13')document.form1.TextBox3.focus();"></asp:TextBox>
        <asp:TextBox ID="TextBox3" runat="server" onkeypress="if(event.keyCode=='13')document.form1.TextBox1.focus();"></asp:TextBox>

Thank You.

No responses found for this thread. Be the first to respond this thread.
Post Reply
Login to post Response.