Lostfocus event in textbox

Discussion in 'ASP .Net Web Controls' started by Annie, May 24, 2006.

  1. Annie

    Annie Guest

    hello guys,

    I am using asp.net 2 and I only can see it has got a textchanged event.

    How can i implemnet the lostfocus event for a text in asp.net?
    Any examples will be appreciated

    thanks
     
    Annie, May 24, 2006
    #1
    1. Advertising

  2. Annie

    Guest

    Hello Annie.
    If you wish to implement client-side javascript for this event then you
    would need to use
    txtDummy.Attributes.Add("onblur", "alert('losing focus');");

    Hopefully you don't want to post back to the server whenever the user loses
    focus. It is extremely annoying, and server resource consuming.

    Hope this helps.
    "Annie" wrote:

    > hello guys,
    >
    > I am using asp.net 2 and I only can see it has got a textchanged event.
    >
    > How can i implemnet the lostfocus event for a text in asp.net?
    > Any examples will be appreciated
    >
    > thanks
    >
    >
    >
     
    , May 24, 2006
    #2
    1. Advertising

  3. Annie

    Annie Guest

    Thanks for your reply,

    However, I was hoping to be able to do something in the server side actually
    ....
    Because it requires some business rules and then need to do some
    calculations based
    on the value of two textboxes and then fill another textbox.

    I didn't want to do all these in javascript ... ;(

    Any other ways around this?

    many thanks

    <> wrote in message
    news:...
    > Hello Annie.
    > If you wish to implement client-side javascript for this event then you
    > would need to use
    > txtDummy.Attributes.Add("onblur", "alert('losing focus');");
    >
    > Hopefully you don't want to post back to the server whenever the user
    > loses
    > focus. It is extremely annoying, and server resource consuming.
    >
    > Hope this helps.
    > "Annie" wrote:
    >
    >> hello guys,
    >>
    >> I am using asp.net 2 and I only can see it has got a textchanged event.
    >>
    >> How can i implemnet the lostfocus event for a text in asp.net?
    >> Any examples will be appreciated
    >>
    >> thanks
    >>
    >>
    >>
     
    Annie, May 25, 2006
    #3
  4. Annie

    mnichols Guest

    The suggestion given could still work for you just modify as follows:

    txtDummy.Attributes.Add("onblur", "form1.submit();");

    At the same time most users would be surprised by this behaviour. Is
    there anyway to redesign your form with a 'submit' or 'evaluate' button
    instead?

    mn

    Annie wrote:
    > Thanks for your reply,
    >
    > However, I was hoping to be able to do something in the server side actually
    > ...
    > Because it requires some business rules and then need to do some
    > calculations based
    > on the value of two textboxes and then fill another textbox.
    >
    > I didn't want to do all these in javascript ... ;(
    >
    > Any other ways around this?
    >
    > many thanks
    >
    > <> wrote in message
    > news:...
    >> Hello Annie.
    >> If you wish to implement client-side javascript for this event then you
    >> would need to use
    >> txtDummy.Attributes.Add("onblur", "alert('losing focus');");
    >>
    >> Hopefully you don't want to post back to the server whenever the user
    >> loses
    >> focus. It is extremely annoying, and server resource consuming.
    >>
    >> Hope this helps.
    >> "Annie" wrote:
    >>
    >>> hello guys,
    >>>
    >>> I am using asp.net 2 and I only can see it has got a textchanged event.
    >>>
    >>> How can i implemnet the lostfocus event for a text in asp.net?
    >>> Any examples will be appreciated
    >>>
    >>> thanks
    >>>
    >>>
    >>>

    >
    >
     
    mnichols, May 25, 2006
    #4
  5. Annie

    Annie Guest

    Thanks for youre reply,
    i think this is one of the alternatives ... and you are right the design
    needs some changes ... coz this makes things very slow
    many thanks

    "mnichols" <> wrote in message
    news:%...
    > The suggestion given could still work for you just modify as follows:
    >
    > txtDummy.Attributes.Add("onblur", "form1.submit();");
    >
    > At the same time most users would be surprised by this behaviour. Is there
    > anyway to redesign your form with a 'submit' or 'evaluate' button instead?
    >
    > mn
    >
    > Annie wrote:
    >> Thanks for your reply,
    >>
    >> However, I was hoping to be able to do something in the server side
    >> actually ...
    >> Because it requires some business rules and then need to do some
    >> calculations based
    >> on the value of two textboxes and then fill another textbox.
    >>
    >> I didn't want to do all these in javascript ... ;(
    >>
    >> Any other ways around this?
    >>
    >> many thanks
    >>
    >> <> wrote in message
    >> news:...
    >>> Hello Annie.
    >>> If you wish to implement client-side javascript for this event then you
    >>> would need to use
    >>> txtDummy.Attributes.Add("onblur", "alert('losing focus');");
    >>>
    >>> Hopefully you don't want to post back to the server whenever the user
    >>> loses
    >>> focus. It is extremely annoying, and server resource consuming.
    >>>
    >>> Hope this helps.
    >>> "Annie" wrote:
    >>>
    >>>> hello guys,
    >>>>
    >>>> I am using asp.net 2 and I only can see it has got a textchanged event.
    >>>>
    >>>> How can i implemnet the lostfocus event for a text in asp.net?
    >>>> Any examples will be appreciated
    >>>>
    >>>> thanks
    >>>>
    >>>>
    >>>>

    >>
     
    Annie, May 27, 2006
    #5
    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. Pratap

    LostFocus Event

    Pratap, Dec 30, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    3,513
    Kevin Spencer
    Dec 30, 2003
  2. jorge
    Replies:
    2
    Views:
    1,295
    jorge
    May 26, 2004
  3. S_K
    Replies:
    6
    Views:
    1,216
    Robert Dunlop
    Nov 8, 2007
  4. blighty

    TextBox lostfocus event

    blighty, Aug 18, 2004, in forum: ASP .Net Mobile
    Replies:
    0
    Views:
    268
    blighty
    Aug 18, 2004
  5. Pratap

    LostFocus GotFocus Events

    Pratap, Dec 30, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    233
    Teemu Keiski
    Dec 30, 2003
Loading...

Share This Page