Event Driven in ASP.NET (Code Behind in VB.NET)

P

Peri

Dear All,

Can anyone help me out to write event driven code in ASP.NET. That is

1. How do I get a Keypress event in a text box (or a control).
2. How do I get a Lostfocus event in a text box (or a control) Say there is
a code (user input). Once he enters the code in the lost focus event I need
to display the name.
 
R

Rick Strahl [MVP]

Hi Peri,

Web applications work differently than desktop apps and most events fired on
the client are not pushed all the way to the server - only a few are -
typically submit actions like Click events or change events on things like
lists. Most other common UI events just fire on the client and must be
handled with client side JavaScript.

You can't really do this with a Web app, unless you handle the appropriate
events in client JavaScript code (ie. onclick, onblur, onchange etc.). You
need to write script code to handle these events which are client side
events and not ASP.NET events. If you want to get really tricky you can
forward those events to the server using AJAX style messages but this is not
automatic by any stretch of the imagination.

+++ Rick ---

--

Rick Strahl
West Wind Technologies
www.west-wind.com
www.west-wind.com/weblog
 
L

Lucas Tam

Can anyone help me out to write event driven code in ASP.NET. That is

1. How do I get a Keypress event in a text box (or a control).
2. How do I get a Lostfocus event in a text box (or a control) Say
there is a code (user input). Once he enters the code in the lost
focus event I need to display the name.

This sort of stuff can be done with Javascript + ASP.NET 2.0's client side
callbacks. If you want to do it in ASP.NET 1.1 take a look at Dart's
livecontrols or AshelyIT's (generic) and Thycotic Javascript Remoting for
ASP.NET.
 
C

Cor Ligthert [MVP]

Rick,
Will you enlighten me, where can Ajax help me in this?
I mean seriously help me in a way that the client can type text in a textbox
using a normal tempo.

Cor
 

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

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top