Call VB Code Behind Function from JavaScript???

J

jason.gyetko

I'm using JavaScript to capture a keypress in my web form. Right now
all it does is post an alert message box. Is there a way to have it
call a function in my VB code behind? All I really want to do is open
another web form when a certain key is pressed. I guess I'd also like
to be able to give focus to a specific textbox on the page when a key
is pressed.

In case you're wondering why... I am scanning in most of my values and
each barcode is prefixed according to the field it goes in, so when
"a123" is scanned, it will get put into a certain field no matter where
the cursor is on the page, and when "b123" is scanned, that will get
put into a certain field and so on.

Any suggestions would be appreciated. Thanks.
 
D

DavidTurcotte

U can use a work around with

document.forms(0).submit() in javascript

That will do a PostBack server-side

for branching, you can use a hidden

document.forms(0).hidField.value="ScanIsOk"

and server side

if request.form("hidField")="ScanIsOk" then....
 
G

Guest

If you want to actually make calls to Codebehind methods in your page via
client-side events, you need to either use Atlas (ASP.NET 2.0) or look into
Remote Scripting ("AJAX") libraries such as Anthem.NET, which is available on
sourceforge.net.
Peter
 
B

bruce barker \(sqlwork.com\)

this should all be easily done with client script, no need to bother the
server.

-- bruce (sqlwork.com)
 

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

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top