在ASP.NET中回发时维护面板滚动位置 [英] Maintain Panel Scroll Position On Postback in ASP.NET

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

问题描述

直到现在才找到任何解决方案。

嗨专家,

我遇到了问题。我有一个asp.net页面。我想在此页面上应用保持滚动位置。我使用过

Not find any solution till Now.
Hi Experts,
I am facing a problem.I have a asp.net page. I want to apply Maintain scroll position on this page. I have used

MaintainScrollPositionOnPostback="true" 

所有树类型(在cs,aspx和web配置中)和许多其他Javascript函数(在谷歌搜索后)。但没有java脚本函数适合我。如果有人对我如何在我的页面上保持我的滚动位置有所了解。请帮助我。我google了很多,但直到现在才找到任何解决方案..例如我使用了java脚本的功能,如...



by all tree types (on cs,aspx and in web config) and many other Javascript functions (after googled).but no java script function works for me. If anyone have an Idea about how I Maintain my Scroll Position on my page .Please help Me. I googled a lots but not found any solution till now ..for example I used functions of java scripts like...

<form id="form1"  runat="server">
  <asp:ScriptManager ID="ScriptManager1" runat="server" ScriptMode="Release" />
   <script type="text/javascript">    
      var xPos, yPos;
      var prm = Sys.WebForms.PageRequestManager.getInstance();

      function BeginRequestHandler(sender, args) {
        if ($get('<%=Panel1.ClientID%>') != null) {         
          xPos = $get('<%=Panel1.ClientID%>').scrollLeft;
          yPos = $get('<%=Panel1.ClientID%>').scrollTop;
        }
     }

     function EndRequestHandler(sender, args) {
         if ($get('<%=Panel1.ClientID%>') != null) {       
           $get('<%=Panel1.ClientID%>').scrollLeft = xPos;
           $get('<%=Panel1.ClientID%>').scrollTop = yPos;
         }
     }
     prm.add_beginRequest(BeginRequestHandler);
     prm.add_endRequest(EndRequestHandler);
 </script>

 <asp:UpdatePanel ID="UpdatePanel1" runat="server">
   <ContentTemplate>
     <asp:Panel ID="Panel1" runat="server" Height="300">
        <----"my html table code here which have drop down,textbox,radiobutton,button etc controls"----->
     </asp:Panel>
   </ContentTemplate>
 </asp:UpdatePanel>
and many othes functions.

Thanks

</form>

推荐答案

get(' <%= Panel1.ClientID%>')!= null ) {
xPos =
get('<%=Panel1.ClientID%>') != null) { xPos =


get(' <%= Panel1 .ClientID%GT;')scrollLeft。
yPos =
get('<%=Panel1.ClientID%>').scrollLeft; yPos =


get(' <%= Panel1。的ClientID%GT;')scrollTop的。
}
}

函数EndRequestHandler(sender,args){
if
get('<%=Panel1.ClientID%>').scrollTop; } } function EndRequestHandler(sender, args) { if (


这篇关于在ASP.NET中回发时维护面板滚动位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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