How to make an ASP.NET TextBox fire it's onTextChanged event fire in an AJAX UpdatePanel?

后端 未结 4 1018
慢半拍i
慢半拍i 2020-12-01 21:54

I am trying to get an textBox to fire it\'s onTextChanged event every time a keystroke is made rather than only firing only when it loses focus. I thought that adding the As

4条回答
  •  伪装坚强ぢ
    2020-12-01 22:19

    • You need to call the _postback() function for your textbox control when the onkeyup is raised using javascript.
    • However, since your textbox is inside your update panel, the textbox will get re-rendered everytime the user hits a key, causing the cursor to loose focus.
    • This will not be usable unless you get your textbox out of the the updatepanel. That may work out for you, as update panels tend to be a bit slow, you may still have usability issues. - I would suggest using an autocomplete component.

    P.S : there is one in the asp.net control toolkit or you could use the jquery autocomplete plugin which I have found to be a bit better.

提交回复
热议问题