Maintain Scroll Position On Postback In Google Chrome Browser Using Asp.Net.
In one of my previous posts i describe Maintaining Scroll Position After Postback. But this method doesn't work with Google Chrome browser.
So we need to go with any of two methods mentioned below.
1. ASP.NET METHOD
Write following code in Page_Load event of page.
Right click on solution explorer > Add New Item
Select Browser File and add it to App_Browsers folder.
Add MaintainScrollPositionOnPostback capability to this browser file as written below.
Build and run the code and it should work with Google chrome.
2. JAVASCRIPT METHOD
We can use scrollsaver javascript file to maintain scroll position In Chrome.
Just add this file in root of solution and add reference to it in head section of page.
hope this helps.
In one of my previous posts i describe Maintaining Scroll Position After Postback. But this method doesn't work with Google Chrome browser.
So we need to go with any of two methods mentioned below.
1. ASP.NET METHOD
Write following code in Page_Load event of page.
protected void Page_Load(object sender, EventArgs e) { MaintainScrollPositionOnPostBack = true; }
Right click on solution explorer > Add New Item
Select Browser File and add it to App_Browsers folder.
Add MaintainScrollPositionOnPostback capability to this browser file as written below.
<browsers>
<browser refID="Mozilla">
<capabilities>
<capability name="supportsMaintainScrollPositionOnPostback"
value="true" />
</capabilities>
</browser>
</browsers>
Build and run the code and it should work with Google chrome.
2. JAVASCRIPT METHOD
We can use scrollsaver javascript file to maintain scroll position In Chrome.
Just add this file in root of solution and add reference to it in head section of page.
1: <script src="scrollsaver.min.js" type="text/javascript">
2: </script>
hope this helps.
If you like this post than join us or share
1 comments:
Excellent solution using javascript method, works well !
Post a Comment