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

Discussion in 'ASP .Net' started by Peri, Aug 8, 2005.

  1. Peri

    Peri Guest

    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.
    Peri, Aug 8, 2005
    #1
    1. Advertising

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


    "Peri" <> wrote in message
    news:...
    > 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.
    >
    >
    Rick Strahl [MVP], Aug 8, 2005
    #2
    1. Advertising

  3. I think you'd be best off using client side code for this kind of thing,
    since a quick response precludes posting back after each individual event is
    fired.

    Here are some examples of adding client side code to your web controls:
    http://SteveOrr.net/articles/ClientSideSuite.aspx

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    "Peri" <> wrote in message
    news:...
    > 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.
    >
    >
    Steve C. Orr [MVP, MCSD], Aug 8, 2005
    #3
  4. Peri

    Lucas Tam Guest

    "Peri" <> wrote in
    news::

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

    --
    Lucas Tam ()
    Please delete "REMOVE" from the e-mail address when replying.
    http://members.ebay.com/aboutme/coolspot18/
    Lucas Tam, Aug 8, 2005
    #4
  5. Rick,

    Will you enlighten me, where can Ajax help me in this?

    Cor
    Cor Ligthert [MVP], Aug 8, 2005
    #5
  6. 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
    Cor Ligthert [MVP], Aug 8, 2005
    #6
  7. Peri

    Peri Guest

    Thanks for all your replies.

    --
    Thanks and Regards,

    Peri
    "Peri" <> wrote in message
    news:...
    > 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.
    >
    >
    Peri, Aug 8, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ben Miller [msft]

    Re: Code Behind vs. no code behind: error

    Ben Miller [msft], Jun 27, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    583
    Alphonse Giambrone
    Jun 28, 2003
  2. =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?=

    Fire Code behind code AND Javascript code associated to a Button Click Event

    =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?=, Feb 10, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    21,224
    =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?=
    Feb 11, 2004
  3. Daniel Manes

    Code-Behind Pain in the Behind!

    Daniel Manes, Jun 10, 2005, in forum: ASP .Net
    Replies:
    11
    Views:
    661
  4. Peri
    Replies:
    2
    Views:
    2,951
  5. John

    Non-code behind to code behind

    John, Feb 19, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    482
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Feb 19, 2007
Loading...

Share This Page