ASP.NET OnTextChanged not firing from inside an update panel

后端 未结 2 1348
甜味超标
甜味超标 2021-01-11 18:01

I am using an ASP.NET update panel to retrieve user info using the on TextChanged for the textbox, here is my code:



        
2条回答
  •  北荒
    北荒 (楼主)
    2021-01-11 18:20

    
    

    AutoPostBack on text-box will trigger post-back when the focus is lost from the text box. TextChanged event will be fired on any subsequent post-back (can be due to button-click or text box focus change). So you need to make certain

    1. After text is changed, you are moving out of text-box
    2. Whatever controls that you are change are part of update-panel (can be different update panel). If there are not part of any update panel then those changes won't get reflected on client side.

    My guess is you are probably suffering from #2. You can use tool such as Fiddler (or Firebug on FireFox) to check if browser is firing AJAX (XHR) request when the focus is lost from the text-box.

提交回复
热议问题