Reputation: 39
How can I get the same scroll position after postback? I am doing code in vb. I have referred and tried everything mentioned in following question link.But nothing worked for me. How to overcome this problem?
Upvotes: 0
Views: 1052
Reputation: 223
try using UpdatePanel
.
that way you do not have to refresh the entire page during postback.
only the UpdatePanel will refresh during postback.
http://msdn.microsoft.com/en-US/library/bb386454.ASPX
Upvotes: 0
Reputation: 4596
DO
Page.SmartNavigation = true
or
MaintainScrollPositionOnPostback = true
or
<%@ Page Language="C#" MaintainScrollPositionOnPostback="true" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
put it in pageload outside of if(!Page.IsPostBack) if using
Upvotes: 1
Reputation: 10285
You can Use Hidden Fields
To store Your Scroll Bar Top and Left Values Before PostBack
And then Obtain Same Value from Hidden Fields
after PostBack
function BeforePostBack()
{
// Save Scroll Bar values in Hidden fields
// ScrollLeft() and ScrollTop()
}
function afterPostBack()
{
// Get Scroll Bar values from Hidden fields
// and assign to Scroll bars
}
Upvotes: 0
Reputation: 10211
MaintainScrollPositionOnPostback = "true" in page declaration should work
Upvotes: 0