当光标放在其他文本框上时,为什么事件发生在特定文本框中 [英] Why event happens on particular textbox when cursor placed on other textbox's

查看:88
本文介绍了当光标放在其他文本框上时,为什么事件发生在特定文本框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3个文本框,即TB1,TB2,TB3。所有文本框都有TB_Validated事件。当我运行代码并将光标放在TB2上时,触发TB1_Validated事件。我可以在debug breakpoint的帮助下查看。是什么原因以及如何解决?

I have 3 textboxs namely TB1,TB2,TB3. All textboxs have TB_Validated events. When I run the code and place the cursor on TB2, the TB1_Validated event is triggered. This I could check with the help of debug breakpoint. What is the reason and how should it be solved?

推荐答案

您观察到的是错误:验证事件是在控制失去焦点,可以是键盘操作(比如用户按Tab键),也可以是用户选择另一个Control时的鼠标操作,或者是调用更改ActiveControl的方法的代码。



如果您希望不发生Validating和Validated事件,则可以将Control的'CausesValidation属性设置为'false。或者你可以编写一个Validating EventHandler并在其代码中将e.Cancel属性设置为'true。



我建议你学习:[ ^ ],[ ^ ]。
What you observe is not an error: the Validated Event is raised when the Control loses focus, either by a keyboard action (like the user pressing the Tab key), or by mouse action as the user selects another Control, or by your code calling a method that changes the ActiveControl.

If you wish for the Validating, and Validated, events not to occur, then you can set the Control's 'CausesValidation property to 'false. Or you can write a Validating EventHandler and in its code set the e.Cancel property to 'true.

I suggest you study: [^], [^].


我认为您已将TB1_Validated事件分配给TB2文本框。

删除此TB1_Validated事件,从属性事件窗口编译并将TB_Validated事件分配给TB2文本框。
I think you have assigned TB1_Validated event to TB2 textbox.
Delete this TB1_Validated event, compile and assign TB_Validated event to TB2 textbox from property-event window.


请从特定文本框属性(aspx代码)中删除OnTextChanged事件,然后事件不会触发。



如果这不起作用,那么发送你的代码。可以使用一些javascript或jquery用于通过pagemethod调用



谢谢
please remove OnTextChanged event from particular textbox property (aspx code) then event will not trigger.

if this not work then send your code. may be used some javascript or jquery used to call by pagemethod

Thanks


这篇关于当光标放在其他文本框上时,为什么事件发生在特定文本框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆