在 ASP.NET 中的回发时维护水平和垂直 ScrollPosition

发布于 2024-09-13 20:37:06 字数 203 浏览 8 评论 0原文

编码采用 ASP.NET C#。
我有一个 gridview,有 1000 条记录,我正在内联编辑其中一行。
单击“更新”时,我希望我的网格位于回发发生之前的确切 xy 位置。
如果您正在考虑使用 Page 指令,MaintainScrollPositionOnPostback="true",不,它对我不起作用
什么是最优化的方法?

The coding is in ASP.NET C#.
I have a gridview, with say 1000 records and I am inline editing one of the rows.
On Clicking Update, I would like my Grid to be on the exact x y position it was on before the postback happened.
If you are thinking along the lines of using the Page directive, MaintainScrollPositionOnPostback="true", no, it didnt work for me
What is the most optimal method?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

一江春梦 2024-09-20 20:37:06

使用 UpdatePanel 控件来包装网格。

另一种方法是使用 ajax,就像使用 jqGrid 组件一样。

Using the UpdatePanel control to wrap your grid.

Another way would be to use ajax instead like using the jqGrid component.

眼泪也成诗 2024-09-20 20:37:06

您可以使用 AJAX UpdatePanel 来避免重新加载整个页面。即使 MaintainScrollPositionOnPostback 由于某种原因无法正常工作,该功能也能正常工作。

You could use an AJAX UpdatePanel to avoid reloading the whole page. That will work even when MaintainScrollPositionOnPostback for some reason does not.

-残月青衣踏尘吟 2024-09-20 20:37:06

创建一个 js 方法来将页面的当前滚动位置记录到隐藏的服务器控件。您可以将其设置为每个更新按钮、onscroll 或在您手动滚动到编辑行之后和回发发生之前触发的任何其他内容上的处理程序。

在服务器处理期间,生成将恢复滚动位置的js代码。将其注册为启动脚本。

create a js method to record the current scroll position of the page to a hidden server control. you could set this up as a handler on each update button, or onscroll, or anything else that will fire after you manually scroll to your edit row and before the postback occurs.

during server processing, generate js code that will restore the scroll position. register this as a startup script.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文