Link to home
Start Free TrialLog in
Avatar of aibar
aibar

asked on

Cannot get TextChanged event to fire

Using Visual Studio, vb.net:  I need to have a text box fill in dynamically without page postback either of two other text boxes change in value.  I have tried using the change event in code-behind for the text boxes and I've tried using javascript in the HTML, all to no avail.  Any suggestions or points to help would be welcome!!
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

If you're trying to use the TextChanged event then that will cause a postback, but only if you have AutoPostBack set to true on the control. Otherwise the event is cached until the next time a Postback is triggered.

You should be able to use javascript on the client. Can you give us an idea of exactly what needs to happen and when ?
Avatar of aibar
aibar

ASKER

I have three text boxes.  When text box #1 or #2  changes in value, I need text box #3 to change in value.  So simple, and I knew how to do it before in regular ASP, but for the life of me cannot do it now?!  Thank you for any help!
ASKER CERTIFIED SOLUTION
Avatar of enwhysee
enwhysee

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aibar

ASKER

Perfect!  Works perfectly and I've learned a lot from this little snippet you gave. Thanks!
Glad it was of help! :)

I just re-read my post, and my comment in the last sentence was of course wrong. The values of TextBox1 & TextBox2 will also be submitted along with the rest of the form data when you do a postback, since they're both input elements (even if they aren't marked as runat="server"). But for practical intents and purposes it doesn't matter a whole lot.

Avatar of aibar

ASKER

One more note - I got an error when I first ran it that I had an illegal character.  Removing the first ";" from this line:
 var textbox3ID="<% Response.Write(TextBox3.ClientID); %>";
solved the problem.  Thanks again!
I see, it must be because you're using VBScript instead of C#. In C# the ; would be required, but in VB it is invalid.
Take care!