TextBox.OnTextChanged fire on typing

Posted on 2009-02-23
Last Modified: 2012-05-06

As we know TextBox.OnTextChanged event do not fired when text is typed, TextBox must lose focus or ENTER key must be pressed in TextBox to execute OnTextChanged.

Maybe someone could suggest hack how to execute OnTextChanged event on typing?

Question by:Tomazaz
    LVL 27

    Accepted Solution

    LVL 21

    Expert Comment

    in jQuery it is very simple with keydown

    Author Comment

    I never used jQuery and even not imagine how to integrate and how it can help me in my situation, do you have example?
    LVL 21

    Expert Comment

    here is a quick working example - jQuery is a great tool that is very versatile and has a huge community with lots of tutorials
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="">
        <script type="text/javascript" src=""></script>
        <style type="text/css">
            div { padding:10px;margin:5px;border:solid 5px navy;}
        <script type="text/javascript">
            $().ready(function() {
                $("#txtDemo").keydown(function(event) {
            This is a demo using jQuery, you can load it locally, or call it from a code library (this demo is using Google's copy).
            Type something in this textbox, and it will show up in the next div:<br />
            <input type="text" id="txtDemo" /><br />
            This is using the jQuery keydown() function you can see in the &lt;head&gt; of this code
        <div id="display"></div>

    Open in new window


    Author Comment

    nmarun, thank you, your links gave me idea.

    So just added second ASP.NET event handler to OnKeyUp

    edtValue.Attributes.Add('onkeyup', 'setTimeout(''__doPostBack(\''' + edtValue.UniqueID + '\'',\''\'')'', 0);');

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Suggested Solutions

    This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
    I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    733 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

    18 Experts available now in Live!

    Get 1:1 Help Now