维护滚动位置并在回发选定的控制 [英] Maintaining Scroll Position and Selected Control on Postback

查看:120
本文介绍了维护滚动位置并在回发选定的控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

返回与其他基于Web的问题。

Back with another web based issue.

当控件发出回发到服务器页面刷新(精细)。该页面还向后滚动到顶部,失去所选择的控制。如果它回传取决于什么变化发生后,控制在相应和可见或隐藏制成。重点是丢失,即使什么也不页面知名度改变明智当前滚动复位。在文本字段中输入的数据被保存,因此任何单选按钮/复选框的选择。问题跳格复位为索引0和页滚动发送回页面的顶部。

When a control issues a postback to the server the page refreshes (Fine). The page also scrolls back to the top and loses the control that is selected. If it's relevent after the postback depending on what changes have happened controls are made visible or made hidden. The focus is lost and current scroll resets even if nothing is changed on the page visibility wise. The data inputted in Text fields is kept and so are any radiobutton/checkbox selections. The problem is tabbing is reset to index 0 and the pages scroll is sent back to the top of the page.

我使用.NET 4.0

I am using .Net 4.0

我曾尝试加入MaintainScrollPositionOnPostback =真无论是ASP页面本身上,并在web.config无济于事。
我曾尝试使用和不使用条件更新引发了阿贾克斯的UpdatePanel时,文本框的文本被更改或单选按钮改变和回传还是引起了滚动和索引损失。

I have tried adding MaintainScrollPositionOnPostback="true" both on the asp page itself and in the web.config to no avail. I have tried with and without the Ajax updatepanel using conditional updating triggering off when textboxes text is changed or radiobuttons are changed and the postback still causes a scroll and index loss.

任何IDE的将是太棒了。 TA!

Any ides would be fantastic. Ta!

推荐答案

首先,在 MaintainScrollPositionOnPostback =真正的在asp.net 2.0中的一个已知的bug,看<一个href=\"http://connect.microsoft.com/VisualStudio/feedback/details/103014/maintainscrollpositiononpostback-and-scrollbars-and-panels-and-treeview-oh-my\"相对=nofollow>这里。

First of all, the MaintainScrollPositionOnPostback="true" has a known bug in asp.net 2.0, see here.

此外,正确的语法是 maintainScrollPositionOnPostback 。 (小写字母m)

Also, the correct syntax is maintainScrollPositionOnPostback. (lowercase m)

我用 maintainScrollPositionOnPostback ,但有许多问题在IE浏览器,然后我用asp.net AJAX控件工具包的UpdatePanel,它解决了这个问题(在页面没有滚动顶端),并节省带宽。

I used the maintainScrollPositionOnPostback but have many problems in IE, then I use the asp.net AJAX Control Toolkit UpdatePanel, it solves the problem (the page don't scroll to the top) and save some bandwidth.

编辑:

我想我明白你的问题,这是十个分量的焦点元素,它可以使用JavaScript的一些解决方法来实现,本身的此处

I think I understand your problem, it's mantain the focus on the element, it can be done using some javascripts workarounds, se here.

希望有所帮助。

这篇关于维护滚动位置并在回发选定的控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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