ASP.NET: Async postback as I type in a text box -
I have a text box control on one page that I want to use to filter the grid. I would like to textbox control back to the page asynchronously, as the user type in values in the text box; Preferably at a fixed interval (i.e. 500 ms after waiting for typing before the user is posted.)
How can I complete this in ASP.net? I know that the updated panel and text box text-centered event does not tell me what I want because it does not fire as a user typing, only after the control is focused or if the page is posted in any other way is.
I do not even want an auto-complete functionality, is there any control what I want to do for me?
You can use jQUery, fire it on the keyway () event, and one Set the setTimeOut method before firing the AJAX call.
$ ("# id input") Keyboard (function () {var $ value = $ (this); if (this.value! = This.lastValue) {if (this.timer) clearTimeout (this.timer); msgbox.css ({"background-image" : "None"}) .HTML ('& lt; img src = "img / ajax-loader.gif" height = "16" width = "16" /> Check availability ...'); this.timer = SetTimeout ($ function {$ .ajax ({type: "POST", Url: "default.aspx / StaticMethod", data: "{'username': ''" + $ value .val () + "'} "," Content Type: "Application / Jason", Dataprice: "Jason", Success: Function (msg) {if (msgd! = 1) Other {//}}});}, 200); .lastValue = this.value;}}}};
Comments
Post a Comment