Scroll bar position in Radgrid gets reset after a postback

7 posts, 0 answers
  1. Rebecca
    Rebecca avatar
    1 posts
    Member since:
    Sep 2010

    Posted 14 Sep 2010 Link to this post

    I have a radgrid in a user control and am using the following code to capture and retain the scroll bar position after a postback

     

    <ClientSettings EnablePostBackOnRowClick="True" EnableRowHoverStyle="True">

     

     

    <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True" ScrollHeight="295px" />

     

     

    <ClientEvents OnScroll="SetScrollPosition" />

     

     

    <Resizing AllowColumnResize="True" />

     

     

    </ClientSettings>

     

    <

     

    script type="text/javascript">

     

     

     

     

    function

     

    SetScrollPosition() {

     

     

    var y = DBSearch1_RadGrid1_GridData.scrollTop;

     

    document.cookie =

    "divPos=!^^->" + y + "<-^^!";

     

    }

    window.onload =

    function() {

     

     

    var cook = document.cookie;

     

     

    if (cook.indexOf("!^^->") != 0) {

     

     

    var start = cook.indexOf("!^^->");

     

     

    var end = cook.indexOf("<-^^!");

     

     

    var pos = cook.substring(start + 5, end);

     

    window.setTimeout(

    function() {

     

    DBSearch1_RadGrid1_GridData.scrollTop.scrollTop = pos;

    }, 0);

    }

     

    }

     

    </

     

    script>

    The problem I am encountering is that the scroll bar does get set to the value of 'pos'  but within a split second it gets reset and is at the first record in the datagrid after a postback. I was wondering if any one has encountered similar issues. Thx

     

  2. Rich
    Rich avatar
    20 posts
    Member since:
    Feb 2004

    Posted 31 Jan 2012 Link to this post

    I am experiencing this problem as well with the latest (2011.3) version. I was hoping that you had a solution because I can't find one yet.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 31 Jan 2012 Link to this post

    Hello,

    This demo explains how to retain the scrollbar position after postback.

    Thanks,
    Princy.
  5. Rich
    Rich avatar
    20 posts
    Member since:
    Feb 2004

    Posted 31 Jan 2012 Link to this post

    Hi Princy,

    Thanks, but I have been there and done that. The settings there are not working in my situation and I still have the problem. I have a trouble ticket open, but was hoping that maybe someone else has ran into this problem and found a solution that I haven't tried yet.

    Thanks,
    Rich
  6. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 02 Feb 2012 Link to this post

    Hi Richard ,

    We have already answered your support ticket.

    I would suggest you to continue our communication in the regular support thread so we could better track the issue.

    Kind regards,
    Maria Ilieva
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  7. TonyG
    TonyG avatar
    239 posts
    Member since:
    Feb 2006

    Posted 08 May 2012 Link to this post

    If there were issues, what was the resolution? (On support myself but would appreciate seeing info like this in the forum too.)
  8. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 09 May 2012 Link to this post

    Hi Tony,

    Actually the problem that Richard faced was determined as bug.The problem appears only in IE9 browser and no matter if ajax is used on the page.
    After further researching on our site we concluded that the problem is in the filtering item of the DateTime column. For some reason it receives a focus after postback and this causes the issue.
    The presented problem is a bug and we have logged it into our tracking system. Our dev team will further investigate the issue and will do the best to provide a fix as soon as possible.
    As for workaround, for now you could hide the picker from the filtering item by settings PickerType="None" for the DateTimeColumn





    Regards,
    Maria Ilieva
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017