Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello buddy

i have been trying to find a good way to maintain the scroll position on a page after an postback. i tried a couple options:

Page.MaintainScrollPositionOnPostBack = True

and the web.config method:

<pages smartNavigation="true" maintainScrollPositionOnPostBack="true" ></pages>

also use a js. script fil name Scroll-sever
and Control.focus();

but neither works.

i have a page and there is 9 file upload control with there own upload button for each.
after every upload button click the event fired and screen jumps to the top of the page. then i have to scroll back down to see the results of the query.
i found a few java script options but not workig, but i am looking for an asp.net solution.

any opinion appreciable ...
Posted

Have you considered putting each file upload control in it's own iFrame? That way you're only posting back the contents of the iframe, not the whole page...
 
Share this answer
 
Comments
Shubh Agrahari 2-Dec-13 1:27am    
its affecting ma other works on that same page so i m not using update panel..and can you explain that how can iframe maintain it ?
http://msdn.microsoft.com/en-us/library/bb398867.aspx[^][^]


Please visit above this will help you surely.

Hope this works for you!!!
 
Share this answer
 
add into web.config
< pages maintainscrollpositiononpostback="True" >
 
Share this answer
 
v2
In your @page register you can put simply

C#
MaintainScrollPositionOnPostback="true"
<![CDATA[<%@ Page Language="C#" AutoEventWireup="true" MaintainScrollPositionOnPostback="true" CodeBehind="WebForm.aspx.cs" Inherits="WebApplication1.WebForm" %>]]>


Tested

Hope This helps!!!
 
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