[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

focusing problem and how to process possible simutanious input?

Posted on 2004-11-04
3
Medium Priority
?
179 Views
Last Modified: 2012-05-05
I am going to develop a testing system: when user scanned the badge, the bar code scanner will return a string (ended with a carriage return). Also, user can type in the badge number using keyboard and press "Enter" key. My questions are:
1. How to put focus of the returned string from bar code scanner to my text box area on the page? (focusing problem)
2. Is there a simple way to implement: whenever there is a "return" action, system will begin processing? i.e. either when the user scanned the badge successfully(so the bar code reader will return a string ended with "enter"), or user typed in the number and press "enter" key, system will automatically go to the next step and process the input number in the text box area?  

Thanks a lot!

-Scott
0
Comment
Question by:heyday2004
3 Comments
 
LVL 28

Assisted Solution

by:mmarinov
mmarinov earned 600 total points
ID: 12491481
Hi heyday2004,

1. for this you have to use javascript method: idoftextbox.focus()
2. check this site : http://www.mag37.com/csharp/articles/DefaultSubmitButton.html?tabid=8

Regards!
B..M
mmarinov
0
 
LVL 21

Assisted Solution

by:surajguptha
surajguptha earned 400 total points
ID: 12492042
For 2)

<asp:textbox id="txtScannedNumber" onKeyDown="javascript:checkkeycode()"></asp:textbox>

function checkkeycode()
{
   if (window.event.keycode==13)
      {
         document.form[0].submit();
      }
}
0
 
LVL 17

Accepted Solution

by:
AerosSaga earned 1000 total points
ID: 12493104
-----------------------------
set focus
-----------------------------
Private Sub SetFocus(ByVal ctrl As Control)
    ' Define the JavaScript function for the specified control.
    Dim focusScript As String = "<script language='javascript'>" & _
      "document.getElementById('" + ctrl.ClientID & _
      "').focus();</script>"

    ' Add the JavaScript code to the page.
    Page.RegisterStartupScript("FocusScript", focusScript)
End Sub

You can now call the custom SetFocus() function from any event handler to change the control focus as needed:


SetFocus(myTextBox);

--------------------------
submit on enter
--------------------------
MyControl.Attributes.Add("onclick", "javascript:if (event.keyCode == 13) document.Form1.submit();")

Aeros
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question