.net – 列表框在autopostback上滚动到顶部
发布时间:2020-12-16 09:49:28 所属栏目:asp.Net 来源:网络整理
导读:为什么在启动autopostback时,asp.net列表框总是在选择项目时滚动到顶部?我怎样才能防止这种情况发生? 解决方法 我在 javascript中添加了以下jquery来解决问题.我不记得我在哪里找到了解决方案,但在这里.只需添加目标控件的位置 – $get(‘YourDiv_YourPane
为什么在启动autopostback时,asp.net列表框总是在选择项目时滚动到顶部?我怎样才能防止这种情况发生?
解决方法
我在
javascript中添加了以下jquery来解决问题.我不记得我在哪里找到了解决方案,但在这里.只需添加目标控件的位置 – $get(‘YourDiv_YourPanel’).
<script type="text/javascript"> //Maintain scroll position in given element or control var xInputPanel,yInputPanel; var xProductPanel,yProductPanel; var prm = Sys.WebForms.PageRequestManager.getInstance(); prm.add_beginRequest(BeginRequestHandler); prm.add_endRequest(EndRequestHandler); function BeginRequestHandler(sender,args) { yInputPanel = $get('MainContent_InputPanel').scrollTop; yProductPanel = $get('MainContent_ProductPanel').scrollTop; } function EndRequestHandler(sender,args) { $get('MainContent_InputPanel').scrollTop = yInputPanel; $get('MainContent_ProductPanel').scrollTop = yProductPanel; } </script> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – 经典ASP和MVC并排,不同的项目?
- asp.net – 具有w3wp应用程序池IIS 7的高内存使用率
- asp.net-core – RemoteIpAddress始终为null
- asp.net核心,角度2,PrimeNG
- asp.net – 什么时候Response.IsClientConnected慢?
- asp.net – 检查ValidationGroup是否从代码隐藏有效
- 一步步开发自己的博客 .NET版(5、Lucenne.Net 和 必应站内
- asp.net-mvc – 为什么我不能在ASP.NET视图中设置断点?
- asp.net-mvc – 如何在ASP.NET MVC中定义视图级变量?
- asp.net-mvc-3 – ASP.MVC 3 Razor在Html.PartialView扩展中
推荐文章
站长推荐
热点阅读