Click here to Skip to main content
15,894,720 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am using updatepanel, in updatepanel gridview is in a div. Div have scrolling but when page render div scrolling takes his starting position.

So how i can maintain Div scrolling in page render.

Thanks
Shubham Gupta
Posted

XML
if you are using IE then its very simple just put the code in your page directive.

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default"
MaintainScrollPositionOnPostback="true" %>

but it will not work in Firefox for that you have to add one browser file into your website

Right click on solution explorer and 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>
 
Share this answer
 
v2
Comments
Member 11449483 1-Sep-15 1:09am    
Sorry Sir it is not working.
Member 4653839 1-Sep-15 1:14am    
please let me know which browser u using for this testing
Member 11449483 1-Sep-15 1:39am    
chrome, MOzilla
Member 11449483 1-Sep-15 6:09am    
Sorry Sir It is not Working.

Please help.
XML
ok, I have your solution. First use below in .aspx page
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" MaintainScrollPositionOnPostback="true"%>
now after that put below code in code behind file
protected void Page_Load(object sender, EventArgs e)
{
SmartNavigation = true;
}
now create a default folder of App_Browsers in root directory and add new item, select browser.browser file and set its name like SafariFix.browser and put replace below code
<!--
You can find existing browser definitions at
<windir>\Microsoft.NET\Framework\<ver>\CONFIG\Browsers
-->
<browsers>
<browser id="NewBrowser" parentID="Mozilla">
<identification>
<userAgent match="Unique User Agent Regular Expression" />
</identification>
<capture>
<userAgent match="NewBrowser (?'version'\d+\.\d+)" />
</capture>
<capabilities>
<capability name="browser" value="My New Browser" />
<capability name="version" value="${version}" />
</capabilities>
</browser>
<browser refID="Safari1Plus">
<capabilities>
<capability name="supportsMaintainScrollPositionOnPostback" value="true" />
</capabilities>
</browser>
</browsers>
it will completely solve your problem, because i already tested in all three browsers
 
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