这个问题是关于gridview的 [英] this question is regard gridview

查看:70
本文介绍了这个问题是关于gridview的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在div元素中放置了一个网格视图,并设置了div元素的样式如下;



style =margin:0; padding:0; border-collapse:collapse; width:350px; height:500px; overflow:auto; background-color:#FF00FF;



因为这个样式div元素显示滚动如果网格视图的高度最大则

div元素高度。



现在当我在网格视图中选择div元素高度的任何行时它会滚动回到第一行会发生什么情况



i不是得到如何解决这个问题,我想保持网格视图的状态,即使选择div元素高度以下的任何行

解决方案

我认为这种情况正在发生在回发上 - 你选择一个项目,它回发并因此重建页面,当它重建时,你失去了你的位置。要尝试的一件事是将你的div放在UpdatePanel中,这会给它一个部分回发而不是完全刷新 - 不记得这是否会实际上抑制滚动重置。更常见的方法是,如果失败,则在客户端脚本中处理此问题 - 在回发之前存储滚动位置,并在返回时恢复它。这是一个演练示例:在维护滚动位置时滚动网格视图 [ ^ ]

i have put a grid view in div element and set the style of div element is as follows;

style="margin: 0; padding: 0; border-collapse: collapse; width: 350px; height: 500px; overflow: auto; background-color: #FF00FF;"

because of this style div elements shows scrolls if grid view's height is biggest then
div element height.

now what happens when i select any row down the height of div element in grid view it scrolls back to first row

i am not getting how to solve this problem and i want to maintain the state of the grid view even after selecting any row below the height of div element

解决方案

I assume this is happening on the postback--you select an item, it posts back and therefore rebuilds the page, and when it rebuilds, you lose your position. One thing to try is putting your div in an UpdatePanel, which will give it a partial postback instead of a full refresh--don't remember if this will actually suppress a scroll reset or not. The more common approach, if that fails, is to handle this in client script--you store the scroll position before posting back, and restore it when you return. Here's a walkthrough example: Scroll Gridview while Maintaining Scroll Position[^]


这篇关于这个问题是关于gridview的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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