TextBox TextChanged事件未正确触发 [英] TextBox TextChanged Event Is not Firing Properly
本文介绍了TextBox TextChanged事件未正确触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨!
我正在Asp.net中制作模块,也正在使用更新面板"和母版页".
我有一个TextBox,在它的TextChanged事件上,我正在计算所需的总时间.
当用户手动在textBox中输入文本时,它正常工作,但是当用户从TextBox的历史记录中选择文本时,该事件根本不会触发.
该怎么办,请帮忙.
谢谢!
Hi!
I am making a module in Asp.net and i am using Update Panel and Master Pages also.
I have a TextBox and on it''s TextChanged Event i am calculating the total time taken.
It is working properly when user enters the text in the textBox manually but when user selects a text from history of the TextBox the event does not fires at all.
What to do Please Help.
Thank You!
推荐答案
使用KeyPress事件.并将您的计算逻辑放在一个方法中.调用TextChanged和KeyPress中的方法.
Use the KeyPress event. And put your calculations logic in a method. Call to the method in TextChanged and KeyPress.
Hope it helps.
仅当文本框的值更改并且光标将从文本框中删除时,才会触发TextChanged事件(请确保文本框的autopostback属性为< blue>真的).无关紧要的是,无论您从哪里选择文本,都可以来自用户键盘或历史记录.
请参阅此以获取更多信息: MSDN:TextBox.TextChanged事件 [ ^ ]
尝试阅读此 [
The TextChanged event will be fired only, when the value of textbox will change and cursor will be removed from textbox(Make sure that autopostback property of textbox is <blue>true). This doesn''t matters that from where you are picking the texts, it can be both from user keyboard or history.
Refer this for more info : MSDN : TextBox.TextChanged Event[^]
Try reading this[^] also.
--Amit
这篇关于TextBox TextChanged事件未正确触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文