TextBox.OnTextChanged fire on typing

Posted on 2009-02-23
Medium Priority
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
  • 2
  • 2
LVL 27

Accepted Solution

nmarun earned 1500 total points
ID: 23710859
LVL 21

Expert Comment

ID: 23710884
in jQuery it is very simple with keydown

Author Comment

ID: 23711901
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

ID: 23712088
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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></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

ID: 23712178
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

807 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