ASPNET 1.1- Question regarding KeyPress Handler?

V

Vagabond Software

I'm just getting started with ASP.NET, but I have a strong grasp of C# and
VB.NET.

When my ASPX page loads, I set focus to a text box that will be populated by
a barcode scanner. All of that is working fine.

Once the barcode is scanned, I want to call my ProcessBarcode method without
the end-user needing to click anything or press the enter key. I saw the
following example and added it to me page_load (if not postback) event, but
I'm a little lost on just how to consume this event handler in the
code-behind:

txtBarcode.Attributes.Add("OnKeyPress", "JavaScript:return handleEnter(this,
event, 1)")

In fact, I just pulled this from another post in this group and am not
entirely sure this is the right course to take. Any help or suggestions
would be greatly appreciated.

carl
 
K

Kris

Hi Carl,

If you dont need to wait till user click or action, as soon as you
assign the textbox value call the ProcessBarcode method. Why you need a
event for this?

Otherwise if you are waiting for Enter key from user, I feel your
approach is right. Check whether the Key is "Enter" and call the
ProcessBarcode method.

Cheers,
Kris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,781
Messages
2,569,619
Members
45,316
Latest member
naturesElixirCBDGummies

Latest Threads

Top