By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,563 Members | 1,066 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,563 IT Pros & Developers. It's quick & easy.

Keyboard Wedge Barcode Scanner - Capture postback

P: 3
Hi

I have created a website which has a number of buttons on it which allow users to add items to there basket, they then click on an AJAX watermarked textbox to set focus before using a keyboard wedge scanner to scan there staff ID card, this causes a postback and validates the user - all works perfectly.

My problem is caused if the user attempts to scan their card before clicking on the watermarked textbox. This then forces a postback to the server and will fire one of the button controls at random (I presume it fires a control which it thinks has got the focus.)

I have tried setting focus to a textbox automatically following a button control being fired this would then ensure that the wrong button is not fire if the user accidentally scans before they set focus of the control. however the cursor only appears in the text box on original page load and not after the control has been updated.

textbox1.focus
updatepanel2.focus

Any body got any suggestions on this???? Is there a way that I can tell how the postback has been fired and therefore being able to trap it? The barcode value is 'pu00000343'

Thanks

Tom
Apr 9 '08 #1
Share this Question
Share on Google+
2 Replies


acoder
Expert Mod 15k+
P: 16,027
Can you post some code so we can have an idea of how you call functions, focus, etc.

If you can add a check when using the scanner that the textbox has focus, that should solve the problem.
Apr 10 '08 #2

P: 3
Thanks,

Difficult to post code as its got 3 seperate user controls.

The first usercontrol is the button usercontrol, this creates image buttons using a datalist.

The user clicks one of these buttons and the onclick event raises an event to the page which inturn is posted back to the second usercontrol which has a tree view showing the different items the user has ordered.

The third control is the control I use for setting the focus for the scanner control this has a normal textbox linked to a textboxwatermarked extender, when the user is ready to scan there card they clich the text box which sets focus scan the card and this then processes the order. - Perfect.

The problem is when they scan and havent clicked the text box, the focus appears to be anywhere on the screen and the button in usercontrol one is beign fired.

I have tried

Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
Me.TextBox1.Focus()
Me.TextBox1.Text = "a"

Me.UpdatePanel1.Update()

End Sub

Which is in the main page, (it is putting the letter in for testing, ) however the cursor is not remaining in this control???

Hope this helps, if not I am back in the office tomorrow and I will knock up a test page which I will be able to post.

thanks

Tom
Apr 10 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.