Why won't my OnTextChanged event fire

Why won't my OnTextChanged event not fire? (VS 2010; C# ASP .NET 4.0)

<asp:TextBox ID="txtToEmailAddresses" runat="server" Width="400px"

    protected void txtToEmailAddresses_TextChanged(object sender, EventArgs e)
        txtSubject.Text = "Completed: " + txtEmpName.Text;
Michael SterlingWeb Applications DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jerry MillerCommented:
Are you performing a partial postback in an update panel? You can set the AutoPostBack="true" in the properties for the textbox.

 <asp:TextBox ID="txtToEmailAddresses" runat="server" Width="400px"
                     ontextchanged="txtToEmailAddresses_TextChanged" AutoPostBack="true"/>
Michael SterlingWeb Applications DeveloperAuthor Commented:
ok, that would probably work so i'll give you the points. my current employer is so afraid of anything so "out of the box" as Ajax Tools that they won't want me to use the required toolkit and scriptmanager etc. needed to make this work.
Jerry MillerCommented:
You don't necessarily have to use the Ajax Toolkit, but I believe that the textbox needs to be in an UpdatePanel so you can see the change. Here is a good example of what I am talking about:


Without using something like Ajax or Jquery, I am not sure that you can see the updates. I use the toolkit controls all over my applications without any issues and my company is pretty strict on what we can do.

Here a couple of good reads on JavaScript and JQuery:



In JavaScript if you use the __doPostBack() method, make sure that your trigger is updating the UpdatePanel where you control is located.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Michael SterlingWeb Applications DeveloperAuthor Commented:
Ok, but for the UpdatePanel with the ContentTemplate control, I definitely will need that AjaxToolkit / and library, right?
Jitendra PatilSr.Software EngineerCommented:
as Jerry already answered your question, just for your update panel clarification

update panel is control provided by asp.net , you don't need any toolkit or library.

 basically it follows the below aspx code pattern

<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
     Email:- <asp:TextBox ID="txtToEmailAddresses" runat="server" Width="400px"
Subject :- <asp:TextBox ID="txtSubject" runat="server" width="400px" />
EmpName:- <asp:TextBox ID="txtEmpName" runat="server" width="400px" />

i've also noted that on your text change event you are setting the values of two different textboxes, so please add those textboxes in the same update panel.

hope this helps.
Michael SterlingWeb Applications DeveloperAuthor Commented:
@litendra Patil: Ok, but I do need a scriptmanager tool though, correct?

script manager error
Michael SterlingWeb Applications DeveloperAuthor Commented:
Thanks to all who contributed.
Jerry MillerCommented:
ScriptManager is part of the System.Web.UI.Control, you won't need to Ajax Toolkit for it. Simply import the System.Web.UI.Control.

In the top of your class add,

Using System.Web.UI.Control

This should make the ScriptManager available.

Michael SterlingWeb Applications DeveloperAuthor Commented:
Thank you. That did work.
Jerry MillerCommented:
Cool,  always happy to help!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.