OnTextChanged

D

Danijel Valentic

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
 
C

Comfort

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
 
R

Robert Koritnik

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

Alex Homer

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.
 

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,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top