Click here to Skip to main content
15,905,563 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear All,


I know this may beeasy question for you but m finding it difficult.

I am using ASP.NET 2.0 version.
In my web page, there is long list of post and comments.
question is , if i scroll down to last post and click like button(Like button is provided for every post).
it goes to top of page.

I want scroll position to be maintained.
i tried using - Page.MaintainScrollPositionOnPostBack = true;
but it is not working.

Please help me out.
Posted
Comments
ZurdoDev 17-Apr-13 8:01am    
That is the right setting so something else is likely doing it. Of course, these days you wouldn't do this with a full postback but would use ajax.
Richard C Bishop 17-Apr-13 10:26am    
That has always worked for me when I put that in the page directive.

if i scroll down to last post and click like button(Like button is provided for every post). it goes to top of page.
Why such implementation? For 'Like' pass on the request asynchronously. Right now, when you clicked the link, a postback happened and thus the top of page.

If you want to stick to current implementation (which is actual issue), try:
Maintain Scroll Position on Postback in ASP.NET 2.0[^]
 
Share this answer
 
Comments
Sweetynewb 18-Apr-13 1:38am    
I am sorry, "Like" is not button, its anchor tag. and the page data is displayed dynamically
I used span tag instead of anchor tag for "Like" link.
And its working now.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900