Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
3.75/5 (3 votes)
See more:
Asp.Net textbox TextChanged event is not firing
Posted
Comments
Sandeep Mewara 7-Aug-12 11:38am    
This is not a well framed question! We cannot work out what you are trying to do/ask from the post. Please elaborate and be specific.
Use the "Improve question" link to edit your question and provide better information.
Sourav Kumar Panda 7-Aug-12 11:42am    
Sorry for dat question but i hv solved dat
mvengaqua 30-Jan-14 1:54am    
hello please help me m facing the same problem..my mail id is mohispks17@gmail.com

use this...
XML
<asp:TextBox ID="TextBox1" runat="server" 
            onkeypress="document.getElementById('Label1').innerHTML=this.value;" />
             <asp:Label ID="Label1" runat="server" Text="" />

Pls Accept solution if it help.
 
Share this answer
 
Comments
Sourav Kumar Panda 7-Aug-12 11:46am    
I hv already done dat
but thnx for gave ur time to solve it :)
mudassir19 19-Jun-13 5:28am    
Thanks a lot. It helped me.
kalsa 6-Jul-16 9:13am    
Nice...
You can set the AutoPostBack property to True just like this:
HTML
AutoPostBack="True"


Will going to work better if you put the textbox inside an updatepanel from AJAX =)

In your html code:
ASP.NET
<body>
    <form id="form1"  runat="server" method="post" autocomplete="off">
    <div>
        <asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True" 
            ontextchanged="TextBox1_TextChanged">
    </div>

    <asp:Label ID="Label1" runat="server" Text="Label">
    <asp:Button ID="Button1" runat="server" Text="Button" />
    </form>
    
</body>


Hope it helps.
 
Share this answer
 
v2
Comments
Sourav Kumar Panda 7-Aug-12 11:07am    
Thnx for your replay
I have already tried this but it is not working
Christian Amado 7-Aug-12 11:09am    
Can you improve your question showing parts of your html code?
Sourav Kumar Panda 7-Aug-12 11:12am    
in my source

<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True"
ontextchanged="TextBox1_TextChanged">
</div>

<asp:Label ID="Label1" runat="server" Text="Label">
<asp:Button ID="Button1" runat="server" Text="Button" />
</form>

</body>

in code behind i just want to change the label text when i change the text in the textbox

protected void TextBox1_TextChanged(object sender, EventArgs e)
{
Label1.Text = TextBox1.Text;
}
Christian Amado 7-Aug-12 11:19am    
Works for me! What type of project do you use?
Sourav Kumar Panda 7-Aug-12 11:26am    
I dont want that text on button click .I want dat text on label dynamically i mean when i change the text in text box dat data should come directly on label
TextChanged: "Occurs when the content of the text box changes between posts to the server." AutoPostBack: "Use the AutoPostBack property to specify whether an automatic postback to the server will occur when the TextBox control loses focus. Pressing the ENTER or the TAB key while in the TextBox control is the most common way to change focus."
 
Share this answer
 
Comments
Member 10232382 13-Sep-13 8:10am    
In my Project i wrote the text changed event to textbox and set the property autopostback="true" it is work fine. But the problem is when press the tab or enter to that textbox It Occurs the PostBack to the enteir page please help me
thanks in advance
ruby kaur 18-May-14 7:03am    
The solution works for me. Thanks a lot.But the problem is when press the tab or enter to that textbox It Occurs the PostBack to the enteir page please help me.
Jayasankar Ramachandran 7-Oct-14 9:07am    
needs to put ajax settings for textbox.
yes textbox changed event works with only tab and enter. may be someone improve this event for while textbox changing.

but i suggest a timer in javascript.

var myVar = setInterval(function () { myTimer() }, 1)
function myTimer() {
.
.
.
here codes
document.getelementbyid("<=%textBox1.ClienID%>).value=document.getelementbyid("<=%textBox1.ClienID%>).value();
.
.
.


}
 
Share this answer
 
v2
Comments
CHill60 5-Jan-15 4:56am    
No. Just No.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900