问题描述
A 文本框
设置为自动回
为改变值应该引起一些(只显示)领域要重新计算和显示。结果,
这工作正常。
A TextBox
is set to AutoPostback
as changing the value should cause a number of (display-only) fields to be recalculated and displayed.
That works fine.
然而,当该字段被标签出来,焦点简要地移动到下一个字段,然后消失当页面重绘所以没有焦点的任何地方。
However, when the field is tabbed out of, the focus briefly moves on to the next field, then disappears when the page is redrawn so there is no focus anywhere.
我想重点要对新的领域,不是我只是改变了文本框。
有没有办法制定出哪些字段具有焦点,并迫使它网页时重绘再有吗?
I want the focus to be on the new field, not the textbox I've just changed.Is there a way to work out which field had the focus and force it to have it again when the page is redrawn?
推荐答案
这是设计。如果你正在使用ASP.NET 2.0 +你可以尝试调用你的TextBox的焦点方法一次回发时($ P在TextBox的TextChanged事件pferably $)。
This is "by design". If you are using ASP.NET 2.0+ you can try calling the Focus method of your TextBox once the postback occurs (preferably in the TextChanged event of the TextBox).
我不知道是否有任何内置的方式来跟踪焦点,但我发现的在$ C $的CProject文章应该做的伎俩。
I am not sure if there is any built-in way to track focus but I found this article in CodeProject which should do the trick.
这篇关于自动回用文本框失去焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!