Click here to Skip to main content
15,910,130 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I'm using ASP.NET, I have more than one dropdown list in a single form ,if I selected a value from dropdown page is scrolling back . I have used MaintainScrollPositionOnPostBack set to True, but the same thing happen again. How do I stop it from jumping to the top of the screen?


Thanks
121s
Posted
Updated 20-Jun-14 2:22am
v4

1 solution

if you are testing this functionality only in IE it should work without any problem. but for Chrome you need to go through the following steps :
1.Right click on the project.
2.Click on “Add” -> “Add New Item”.
3.In the “Add New Item” window, select “Browser File” and click “Add”.

4.Application will ask you to place this file in “App_Browsers” folder, click “Yes”
5.Now add the capability of maintaining the scroll position as follows:

C#
 <browsers>
  <browser refid="Safari1Plus">
    <capabilities>
      <capability name="supportsMaintainScrollPositionOnPostback">
          value="true" />
    </capability></capabilities>
  </browser>
</browsers>


For more information refer to the following links
Maintain Scroll Position Problem fix for Chrome.[^]

http://msdn.microsoft.com/en-us/library/system.web.ui.page.maintainscrollpositiononpostback.aspx


and also here they mentioned that this functionality didn't used to work in Firefox, it's fixed in Dec 29th 2011 ASP.NET hotfix.
http://connect.microsoft.com/VisualStudio/feedback/details/714316/asp-net-4-0-30319-maintainscrollpositiononpostback-now-fails-in-firefox[^]


if you want to have your own custom solution you can refer to the following link :

http://www.aspsnippets.com/Articles/ASPNet-MaintainScrollPositionOnPostback-not-working-in-Firefox-and-Chrome.aspx[^]
 
Share this answer
 
v2

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