TextChange事件失去了对asp.net的关注 [英] TextChange event loose focus in asp.net

查看:88
本文介绍了TextChange事件失去了对asp.net的关注的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试一件非常简单的事情.我有3个文本框和3个标签.在更改文本时,我正在设置标签的内容.

I am trying a very simple thing. I have 3 textboxes and 3 labels. On text change i am setting the content of label.

问题是,当我在第一个文本框(例如50)中插入一些值时,将焦点更改为另一个文本框,则标签中的值会完美地反映出来.但是我在第二个文本框上设置的焦点丢失了.并且焦点失去了某个地方.我需要再次单击第二个文本框才能获得焦点.

The issue is when i insert some value in 1st textbox(e.g 50) change the focus to another textbox the values in label is reflected perfectly. But the focus which i setted on 2nd textbox is lost. And the focus is lost somewhere. I need to click again on 2nd textbox to get focus.

如果单击TAB来更改焦点,则会重现相同的问题.

The same issue is reproduced if TAB is clicked to change focus.

我为此制作了一个小型演示项目并附加了.您可以从下面的链接中获取信息

I have made a small demo project for the same and attached. You can avail that from the below link

https://skydrive.live.com/redir?resid= A716D678775EEF95!115& authkey =!ABp6kAon_ZNDLBU

请有人帮我...我在做什么错??

Please someone help me...what am i doing wrong??

预先感谢...

推荐答案

这是ASP.NET中的一个相当普遍的问题,如下所述:在页面部分回发后如何在UpdatePanel中保持焦点位置.这些链接还包含有关如何解决此问题的建议.

This is a rather common issue in ASP.NET, as described here: http://www.codeproject.com/Articles/17571/Maintain-focus-between-postbacks-in-ASP-NET-2-0-al or here: How do I maintain focus position in UpdatePanel after page partial post back. Those links also contain some suggestion on how to solve this issue.

一种可能的解决方案是保持对焦点的控制,将有关它的信息放到一个隐藏的字段中,并在回发后手动恢复焦点.在提到的第一个链接中介绍了此方法.

One of the possible solutions is to keep track of control with focus, put information about it into a hidden field and manually restore the focus after postback. This method is described in the first link mentioned.

这篇关于TextChange事件失去了对asp.net的关注的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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