question

HiteshkumarPatel-3921 avatar image
0 Votes"
HiteshkumarPatel-3921 asked YijingSun-MSFT edited

TextChange Event

Hi All,
I created one small web application to scan barcode with one text box and one list view for our scanning device previously we are using window CE device. In this device i have option to press enter key automatically. But now we are upgrade our device which came with android and there is no option for enter key I try OnTextChanged even with AutoPostBack = true but its not work for me until and i press sum ware in page. basically this event is work like lost focus. i want behave like keypress event
Can any one help me about this

Thanks in Advance.

dotnet-aspnet-generaldotnet-aspnet-webformsdotnet-aspnet-webpages
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Is there some type of setting for this.
Maybe a "tab" key, or "enter" key to be pressed at the end of the scan?

In most cases, some type of "end" character is available. You could then add some JavaScript to the text box, and when that termination character is seen, then you could have the javascript "click" a button for you. That way, you get a simple and easy code behind stub to use. However, this idea only is good if you can (or already have) a termination character.

I suppose you could also consider checking the length of the text box so far, but this is not all that great for a scan in which some characters might have been missed.

0 Votes 0 ·
Bruce-SqlWork avatar image
0 Votes"
Bruce-SqlWork answered

the OnTextChanged event is a server event. AutoPostBack javascript does a form submit when the textbox loses focus. you will need to implement your own javascript autopostback based on the keypress event.

hint: if you do not know the number of characters from the reader, then just use a watchdog timer. say 100ms since last char typed or field length changed.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

YijingSun-MSFT avatar image
0 Votes"
YijingSun-MSFT answered YijingSun-MSFT edited

Hi @HiteshkumarPatel-3921 ,
Why you don't use keypress event? I suggest you could write a hidden button and then you could press "Enter" key to trigger the event. Just like this:
In this, I use the javascript.
200464-new-text-document.txt
201324-screenshot-2022-05-12-161136.png
201325-screenshot-2022-05-12-161221.png

Best regards,
Yijing Sun


If the answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our  documentation  to enable e-mail notifications if you want to receive the related email notification for this thread.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.