This is a migrated thread and some comments may be shown as answers.

Scroll bar position in Radgrid gets reset after a postback

6 Answers 216 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rebecca
Top achievements
Rank 1
Rebecca asked on 14 Sep 2010, 08:59 PM
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

 

6 Answers, 1 is accepted

Sort by
0
Rich
Top achievements
Rank 2
answered on 31 Jan 2012, 12:23 PM
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.
0
Princy
Top achievements
Rank 2
answered on 31 Jan 2012, 12:51 PM
Hello,

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

Thanks,
Princy.
0
Rich
Top achievements
Rank 2
answered on 31 Jan 2012, 12:57 PM
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
0
Maria Ilieva
Telerik team
answered on 02 Feb 2012, 02:57 PM
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
0
TonyG
Top achievements
Rank 1
answered on 08 May 2012, 09:53 PM
If there were issues, what was the resolution? (On support myself but would appreciate seeing info like this in the forum too.)
0
Maria Ilieva
Telerik team
answered on 09 May 2012, 02:40 PM
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.
Tags
Grid
Asked by
Rebecca
Top achievements
Rank 1
Answers by
Rich
Top achievements
Rank 2
Princy
Top achievements
Rank 2
Maria Ilieva
Telerik team
TonyG
Top achievements
Rank 1
Share this question
or