I think its better to use ajax and jquery for what you are trying to accomplish than to postback every key press.
Please check this LINK for more details and example.
Also, the OnTextChanged event fires when you loose focus and not while you type, which seems your requirement.
From an answer in CodeProject:
TextChanged: "Occurs when the content of the text box changes between
posts to the server." AutoPostBack: "Use the AutoPostBack property to
specify whether an automatic postback to the server will occur when
the TextBox control loses focus. Pressing the ENTER or the TAB key
while in the TextBox control is the most common way to change focus."
Sample code :
Source : https://jqueryui.com/autocomplete/
<script>
$(function() {
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Scala",
"Scheme"
];
$( "#tags" ).autocomplete({
source: availableTags
});
});
</script>
</head>
<body>
<div class="ui-widget">
<label for="tags">Tags: </label>
<input id="tags">
</div>
IMPORTANT : If you still plan to use keypress then read below quote,
The value of the input text box, during onKeyPress is always the value
before the change.
Also it wont fire for "backspace" in chrome.
Sample Fiddle
If you are still interested in OnKeyPress, I suggest you to have a look at this SO Question.
This is what you are trying to do, but the question is old and newer and better things have come up like HTML 5.
Note : Using on KeyUp Event would not trigger if you use Right click => Paste. To check here is a Fiddler link.