Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Radpanelbar scroll issue

I have scroll issue of Telerik control RadPanelBar. Page is on auto refresh. On page refresh RadPanelBar scroll goes upward. I handle this with JavaScript. Below is the image.

enter image description here

Below is the code. Its working fine for dealers contacts scroll, but not for staff. I am trying the same way(method) to maintain scroll position for staff.

<script type="text/javascript">

   $(".rpSlide ul").scroll(function() { 
       SaveStafftScrollPosition();            
   });

   function SaveStaffScrollPosition(){
       yPos = $(".rpSlide ul").scrollTop();        
   }

   function ReturnStaffScrollPosition() {
       $(".rpSlide ul").scrollTop(yPos);        
   }

   function OnResponseEnd(sender ,eventArgs){
       ReturnStaffScrollPosition();
   }

   function OnRequestStart(sender ,eventArgs){
       SaveStafftScrollPosition();
   }

In HTML having piece of code.

<telerik:RadAjaxManager ID="RadAjaxManager1"  runat="server"
         ClientEvents-OnRequestStart="OnRequestStart" 
         ClientEvents-OnResponseEnd="OnResponseEnd" 
         OnAjaxRequest="RadAjaxManager1_AjaxRequest">
    //some code here
</telerik:RadAjaxManager>

Problem is this it saved scroll position zero for staff when i scroll down. Why it always saved scroll position to zero for staff contacts even i scroll down to middle/end?

like image 694
Mubarak Avatar asked Nov 12 '22 19:11

Mubarak


1 Answers

Have you tried using the MaintainScrollPositionOnPostback property of your @Page tag and setting the AutoEventWireup property to false?

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="YourPage.aspx.vb"
MaintainScrollPositionOnPostback="true" Inherits="YourPageClass" %>

MSDN Documentation

AutoEventWireup

Indicates whether the page's events are autowired. true if event autowiring is enabled; otherwise, false. The default is true. For more information, see ASP.NET Web Server Control Event Model.

MaintainScrollPositionOnPostback

Indicates whether to return the user to the same position in the client browser after postback. true if users should be returned to the same position; otherwise, false. The default is false.

Note : Developers can define this attribute for all pages by setting the maintainScrollPostitionOnPostback attribute (note that it is case-sensitive in configuration files) on the element of the Web.config file.

like image 197
Francis P Avatar answered Nov 15 '22 10:11

Francis P