TextChanged event function not working

Your TextBox is a server control, and text changed is a server event. It is not meant to be fired each time you type a letter, rather it is fired if the text value is different from the value at the time of the last server post back.

If you need to run some kind of code each time a letter is pressed you will need to register and handle the client-side events OnKeyUp / OnKeyDown / OnKeyPress with VB or JavaScripting.


You need to enable AutoPostBack on the TextBox that results in the event.

The problem with your code is it's a server-side event trying to invoke a client-side event. The text needs to be entered in TextBox1 and then it will result in the AutoPostBack.

<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True"></asp:TextBox> 

Based on your need though. It may be better to populate the TextBox2 with the value from TextBox1 using JavaScript.

Tags:

Asp.Net