Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DropDownLists & Scanners

Status
Not open for further replies.

kizmar2

Programmer
May 25, 2004
164
US
I have a problem that I'm stumped as to how to trouble shoot.

I have a "scan.aspx" page with a dropdownlist that's populated at page load with a list of student ID's. The focus is also set to this object on page load. On selectedindexchange, I'm firing code that inserts a record into a history table.

When someone scans a student ID card, it's dumping the text into the dropdownlist. There are some odd things happening though and I'm not sure why.

Here's the test:

The dropdownlist (selectedvalue) has the following values (studentUID): "2 2260 913381992", "2397", "A0000011249", "stu00001", "stu00002", "stu00003", "stu00004" (sorted in that order - asc).

The selecteditem is set to the student's actual table ID (studentID). I'm assuming though, that when a card is scanned, it's using the value of the dropdownlist, not the item.

When the card with "2397" is scanned, it works the say it should.

When I scan the card with the "A0000011249", it's selecting that value in the list, running the selectedindexchanged function, then also selecting the "2397" value and running the selectedindexchanged fucntion again.

Also, if the card with "2 2260 913381992" is scanned, it's selecting that value, then also selecting the "2397" value again.

Can anyone help? Is there a better way to do this? I thought about switching out the dropdownlist with a text field, but then I'm not sure how to fire a function automatically when a card is scanned. The textchanged event is only fired when focus is lost, and during this process, the focus stays on this field.

KizMar
------------
 
some code samples of your page load would help and your onchange event.

adding a list item to be the first one would help you add,

(ddl.items.insert(0,new ListItem("--Scan Card Please--",0))

if ddl.selectedIndex > 0 then process event else dont
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top