GridView在行选择后滚动回顶部 [英] GridView is scrolling back to top after row selection

查看:136
本文介绍了GridView在行选择后滚动回顶部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ma网站上有一个很长的GridView控件。它允许行选择。问题是,当我向下滚动这个GridView并选择一些底部行时,选择发生,但是整个GridView正在滚动返回顶部。如果在回发过程中发生这种情况,那么在您的<%@ Page%>页面;您可以添加以下内容:

  MaintainScrollPositionOnPostback =true

这是在.NET 2.0中添加的,并在页面中添加了一些JavaScript以确保页面向下滚动到引起回发的控件。



可以享受美食。


I've got one long GridView control on ma website. It allows row selection. The problem is, when I scroll down this GridView and select some of the bottom rows the selection occurs, but whole GridView is scrolling back to top. Does enyone know how to avoid this?

解决方案

If it's happening during a postback, then in your <%@ Page %> directive you can add the following:

MaintainScrollPositionOnPostback="true"

This was added in .NET 2.0, and adds some JavaScript to the page to ensure that the page scrolls back down to the control that caused the postback.

Works a treat.

这篇关于GridView在行选择后滚动回顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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