Click here to Skip to main content
16,019,018 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using a master page with multiple of web pages. In one page, i have multiple textbox in web application (ASP.NET 3.5). Here I want, when i press the enter key cursor will goes to another textbox.
How can i implement this using C# coding?
please guide me ..
Thanks !!!
Posted
Comments
Sergey Alexandrovich Kryukov 25-Jul-12 2:43am    
Why cannot you?
--SA

you can use "keypress" event or "ProcessCmdKey" event and compare the keychar value with "\n" and you can navigate to where ever you want.
 
Share this answer
 
Comments
Sandeep Mewara 25-Jul-12 5:42am    
It's tagged as ASp.NET not winforms.
SubrahmanyamGurram 25-Jul-12 5:45am    
sorry sorry i forget that. is there no event to handle the "keypress" in ASP.NET Mr.Sandeep
You can use onkeydown event to trap the event keycode and then press tab keycode.

Try something like this for the textbox:
HTML
<input type="text" onkeydown="EnterToTab()">

JS code:
JavaScript
function EnterToTab(){
  if (event.keyCode==13)
    event.keyCode=9;
  }


PS: This is not suggestible as Enter and Tab have two different functions to perform and playing with them like this not good.
 
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