Click here to Skip to main content
13,048,805 members (86,185 online)
Rate this:
Please Sign up or sign in to vote.
See more:
how to focus next textbox when we press enter key on previous textbox using tab order , because i couldnt sent the next co
ntrol id to the javascript.
Posted 19-Sep-10 23:51pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

usankardurai 21-Sep-10 1:49am
Thank U Hiren Solanki.
Hiren Solanki 21-Sep-10 1:50am
Thanks, If you got the answer then please mark it as answer
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Hai Friends,

You dont Have to send control id to move next control, u just assign unique tabindex to the each control on the page,

Put the coding in <Head> tag of file ,
<script language ="javascript" type ="text/javascript" >
function FocusNext(cid)
 var i=document.getElementById ( ('tabindex');
 var iKeyCode = 0;
    if (window.event)
    iKeyCode = window.event.keyCode
     else if (e)
     iKeyCode = e.which;
     if (iKeyCode == 13)
         var ctrl=document.all;
         for(var count = 0; ctrl.length ; count ++)
               if(ctrl[count].tabIndex == i+1)
     return true;


Add OnKeyPress Event in TextBox
<asp:TextBox ID="TextBox1" runat="server" TabIndex="1" Width="50px"  onKeyPress="FocusNext(this)"></asp:TextBox>
rezasaidy 27-Feb-12 7:29am
how can pushing enter and after that focous on Button for reching text box.

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

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 21 Sep 2010
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100