Text Changed Event

Dawie de Villiers
Dawie de Villiers used Ask the Experts™
on
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));
        }
    }
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
tboContent.Attribute.Add("OnBlur","return TxtChange();")
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
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

Commented:
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

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial