[英]ASP.NET Focus Scrolls Page to Input
I have a few textboxes/labels inside of an UpdatePanel. 我在UpdatePanel中有一些文本框/标签。 When I tab out of one of the textboxes, a label has to be updated with some text.
当我跳出其中一个文本框时,必须使用一些文本来更新标签。 This causes focus on the page to reset to the topmost element.
这将导致页面上的焦点重置为最上面的元素。
This is a data-entry form and the users expect to not have to use the mouse at all. 这是一种数据输入形式,用户希望根本不必使用鼠标。 I can set focus back on the correct textbox in code:
我可以将焦点重新放在代码中正确的文本框上:
Page.SetFocus(tbxInput);
or 要么
tbxInput.Focus();
In IE, the browser scroll position is maintained (woo hoo!). 在IE中,将保持浏览器滚动位置(呼!)。 In Chrome and Firefox it is not;
在Chrome和Firefox中则不是。 the scroll location is adjusted so that the focused textbox is the last element shown on the page.
调整滚动位置,使焦点突出的文本框是页面上显示的最后一个元素。 This is really disturbing to the user.
这确实给用户带来困扰。
I am using the following rules in my web.config: 我在web.config中使用以下规则:
<pages theme="Default" styleSheetTheme="Default" maintainScrollPositionOnPostBack="true" validateRequest="false">
How can I achieve the behavior that IE has? 如何实现IE的行为?
对于这种情况,我从javascript更新了标签文本(可能使用对Web服务或页面方法的AJAX调用)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.