Keyboard Wedge Barcode Scanner - Capture postback

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tomwilliams
    New Member
    • Apr 2008
    • 3

    Keyboard Wedge Barcode Scanner - Capture postback

    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.fo cus

    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
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    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.

    Comment

    • tomwilliams
      New Member
      • Apr 2008
      • 3

      #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 textboxwatermar ked 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.EventArg s) Handles Me.PreRender
      Me.TextBox1.Foc us()
      Me.TextBox1.Tex t = "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
      Last edited by tomwilliams; Apr 10 '08, 09:32 AM. Reason: Additional Comment

      Comment

      Working...