Text Changed Event

Posted on 2008-11-17
Last Modified: 2013-12-17
Does Text changed event work on ASP Pages. I want the event to be trigerred after i type in a character in a textbox. I have set the autopostback to true on the textbox but the event is only trigerred after i click on another control which will submit the form. I even tried registering the event at startup in javascript like tboContent.Attribute.Add("OnChange","return TxtChange();") but still diint work.
 protected void tboContent_TextChanged(object sender, EventArgs e)
        if (tboCharacters.Text.Length <= 160)
            tboCharacters.Text = Convert.ToString(160 - Convert.ToInt64(tboContent.Text.Length - 1));
Question by:dawie
    LVL 2

    Assisted Solution

    tboContent.Attribute.Add("OnBlur","return TxtChange();")

    Accepted Solution

    Hie, Thank you for your response but i didnt work, its just working the same as onchange, i will have to send a postback using other controls.

    Thank you
    LVL 22

    Assisted Solution

    Text Changed event fires with a full postback when the TextBox control looses its focus, in another word, when the cursor moves away from the TextBox to another control such as using Tab or clicking a button, etc.

    Author Comment

    Thank you very much guys,
    I finally figured out how to solve this, the "onkeyup event" doesnt need a postback and its updating the other textbox perfectly without a postback.

    Thnak you very much

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Suggested Solutions

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now