How to detect textbox change event from javascript

后端 未结 4 1300
轮回少年
轮回少年 2020-12-11 07:11

I have a textbox asp.net server control. I am modifying the value of textbox from javascript i want to detect when the textbox text is changed. I tried onchange event which

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-11 07:50

    You could force a postback from javascript and hence forcing a page reload event. In the Page.GetPostBackEventReference() you can handle the event and perhaps fire some other event.

    This is not a good solution thougth and I truly recommend that you do it all thru javascript or drop the javascript and let .NET hadle everything, perhaps with Ajax.NET

    The following link explains hwo you do it for a normal button, but it shouldn't be to hard to make it for a onchange event.

提交回复
热议问题