Click here to Skip to main content
15,889,116 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Project Details - asp.net with C#, sql server 2005, Ajax
I know textchanged event fires only after the TB loses focus. But i want myfunc() (present in code behind) to fire immediately after text changes in the textbox. I have already tried textchanged event, webmethod etc but nothing really worked. Can Ajax do it? or any other ways?

Remember myfunc() has some ado queries so that some values in a panel changes after each change in textbox.


Thanks
Posted
Comments
José Amílcar Casimiro 24-Jun-13 7:48am    
Make sure that CausesValidation is set to false.
gyaan86 24-Jun-13 7:56am    
It is already set to false.
José Amílcar Casimiro 24-Jun-13 8:17am    
Can you paste here some relevant code?
José Amílcar Casimiro 24-Jun-13 8:18am    
Use Improve question option please.
ZurdoDev 24-Jun-13 8:27am    
You need to use javascript and onkeyup.

1 solution

JavaScript
$('#textMessage').keyup(function(event) {
  if (event.keyCode == 13) {
    var message =  $('#textMessage').val();
    alert(message);
  } else {
    return true;
  }
}); //endTextMessage keyup


You may use in this way
 
Share this answer
 
Comments
gyaan86 13-Aug-13 1:19am    
I need to execute some SQL queries within that function and assign the output values to some controls. All that should happen when text changes in the textbox.
Now Question is can i use SQL queries in a Javascript function? If yes then how?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900