I am building a web Application using ASP.NET with Ajax functionality.
In my Application, I don't want the document scroll position to be changed after a patial postback. I have set maintainScrollPositionOnPostBack in Web.Config to "true". But, somehow it's not working.
<pages maintainScrollPositionOnPostBack="true" >
<controls>
<add tagPrefix="ig" src="~/Controls/SOAGrid.ascx" tagName="ExcelGrid"/>
<add tagPrefix="ig" src="~/Controls/IgMenu.ascx" tagName="IgMenu"/>
<add tagPrefix="ig" src="~/Controls/IgList.ascx" tagName="IgList"/>
</controls>
</pages>
Then, I tried Javascript/Jquery to store the scrollTop position, and set it back after the postback is finished.
var bodyScrollTop = 0;
function BeginRequestHandler(sender, args) {
bodyScrollTop = $(document).scrollTop();
}
function pageLoad() {
$(document).scrollTop(bodyScrollTop);
}
But, this is also not working. I found out there are some javascript methods namely scriptResource.axd which run after all my scripts. In this script, there is a code WebForm_AutoFocus which resets my document scroll position. Please suggest me a solution for this.