Click to See Complete Forum and Search --> : Textchanged event of Textbox control is not firing


rahulvasanth
November 15th, 2005, 07:57 AM
Hi

In my web form I have a textbox control whose textmode is set as "multiline". The "textchanged" event of the textbox is not triggering.

What could be the reason for this ?

Thanking in advance

HairyMonkeyMan
November 15th, 2005, 08:05 AM
It only fires once the textbox looses its focus (and only if autopostback is set to true - i think)

good luck

rahulvasanth
November 15th, 2005, 08:13 AM
yeah, that's right,

but I want the event to trigger when I type something in the textbox, i.e when the text in the textbox changes.

similar to "change" event of textbox in VB 6.0.

It is possible ?

HairyMonkeyMan
November 15th, 2005, 08:23 AM
You might be able to do something with javascript...

I think the reason it waits until the focus is lost is that it needs to postback to the server to check whether the text has changed or not.

It might also be possible to rig some sort of timer to check the text instead of waiting for a postback.

Shuja Ali
November 15th, 2005, 08:37 AM
I just wanted to add few things here. Lately I have been seeing threads from Rahul regarding Client Side actions, Similar to the above one. ASP.NET controls don't have these kinda events, because they are very expensive to fire when you are working in a browser and the app is residing on the internet, the reason being that you have to make round-trips to the server for even a small thing. Imagine a person who uses a web application that does round-trip to the server everytime he presses a key or moves the mouse. Won't that annoy the user and eventually the user will stop using the application.
Using pure ASP.NET will not help in these cases. You will need to use a Client Side Scripting tools like Javascript. Javascript is very robust and can do almost anything in the Client Side. Say for example you want to show-up something in a Label when user writes changes something in textbox. This can easily be done using Javascript rather than VB/C#. Most of the web-sites use Javascript along with VB/C# code, so you can also use the same.

Take a Look at Javascript Tutorials (http://www.google.co.in/search?hl=en&q=Javascript+%2B+tutorial&meta=)and see what they can do for you

HanneSThEGreaT
November 15th, 2005, 12:02 PM
similar to "change" event of textbox in VB 6.0.


You could use the onchange() javascript function.
Here's a small snippet of what it should look like:

<input type = "textbox" onchange = "SomeFunction()">
What exactly do you want to do when the text changes ¿