OnTextChanged

Discussion in 'ASP .Net Web Controls' started by Danijel Valentic, Sep 23, 2004.

  1. Hello!

    I want to catch the contents of textbox while the user is entering the
    message in order to send it to the server for SQL select. I mean if the user
    entered "m" I want to be able to go to server and fill all the words like
    '%m%', then the user enters "o", it makes "mo" and i want to bring all words
    like '%mo%'. I want to change a TextChanged event in a way... This event is
    just what I need, but it must be trigered after every key pressed, and not
    on leaving the TextBox. Can you please tell me how to do it?

    Thanks in advanced, d
    Danijel Valentic, Sep 23, 2004
    #1
    1. Advertising

  2. Danijel Valentic

    Comfort Guest

    Create a module and declare your public variable. i.e
    public taketext as string

    After that on textchanged event assign the value of your text to the
    declared value. Then continue with the value on your declared variable to do
    what you want.

    Regards,

    Comfort
    "Danijel Valentic" <> wrote in message
    news:...
    > Hello!
    >
    > I want to catch the contents of textbox while the user is entering the
    > message in order to send it to the server for SQL select. I mean if the

    user
    > entered "m" I want to be able to go to server and fill all the words like
    > '%m%', then the user enters "o", it makes "mo" and i want to bring all

    words
    > like '%mo%'. I want to change a TextChanged event in a way... This event

    is
    > just what I need, but it must be trigered after every key pressed, and not
    > on leaving the TextBox. Can you please tell me how to do it?
    >
    > Thanks in advanced, d
    >
    >
    Comfort, Sep 23, 2004
    #2
    1. Advertising

  3. That's not a smart idea. I strongly suggest not to do that. Users tend to
    type much much faster that the information from client will be sent to
    server and back.

    However it's still possible to make your functionality. YOu will have to
    append a client event onKeyPress that will fire form submission to server.
    But believe me: even when working with ULTRAFAST servers this wouldn't work
    well.

    There's another possibility using Remote calling to server. This way you
    would have complete control over server requests and if the user would type
    faster you would display the results when they are really there. Check some
    Remote Script Call javascript samples on the net.

    This technique is used for "nested" dropdown data. When a user selects
    something in the first dropdown, the second one gets dynamicly filled
    according to that selection.

    --
    P.S. Zakaj pa sploh mislite, da bi bilo to pametno ravnanje?
    --
    Robert Koritnik
    { Clever? No just smart. }


    "Danijel Valentic" <> wrote in message
    news:...
    > Hello!
    >
    > I want to catch the contents of textbox while the user is entering the
    > message in order to send it to the server for SQL select. I mean if the

    user
    > entered "m" I want to be able to go to server and fill all the words like
    > '%m%', then the user enters "o", it makes "mo" and i want to bring all

    words
    > like '%mo%'. I want to change a TextChanged event in a way... This event

    is
    > just what I need, but it must be trigered after every key pressed, and not
    > on leaving the TextBox. Can you please tell me how to do it?
    >
    > Thanks in advanced, d
    >
    >
    Robert Koritnik, Sep 23, 2004
    #3
  4. Danijel Valentic

    Alex Homer Guest

    If there are not too many words, you could send them all to the client as a
    JavaScript array and then use the keyPress event in client-side script to
    display the matching ones. That would avoid the need to do postbacks every
    key-press, which (as Robert says) is not a good idea.
    Alex Homer, Sep 28, 2004
    #4
    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. Henri
    Replies:
    6
    Views:
    745
    Henri
    Aug 6, 2004
  2. =?Utf-8?B?TmVpbA==?=

    OnTextChanged not firing??

    =?Utf-8?B?TmVpbA==?=, Oct 5, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    4,259
    =?Utf-8?B?TWFyeUE=?=
    Aug 29, 2005
  3. =?Utf-8?B?TmVpbA==?=

    OnTextChanged and DataGridItems

    =?Utf-8?B?TmVpbA==?=, Oct 6, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    439
    =?Utf-8?B?TmVpbA==?=
    Oct 6, 2004
  4. onTextChanged not firing

    , Feb 1, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    14,380
    =?Utf-8?B?c2FyYQ==?=
    Feb 2, 2005
  5. Alex Nitulescu

    JavaScript for OnTextChanged event.

    Alex Nitulescu, Mar 5, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    53,591
    Wilco Bauwer
    Mar 5, 2005
Loading...

Share This Page