Hello, guys
Some times most of the developers get fedup of the MaintainScrollPositionOnPostback, Because most of the time it doesn't work in our applications..
There are several solutions the experts have found. the idea is to Preserve Scroll position on Postback then on the Page_Load give the Position back again to the Scroll.
Javascript Method..Some times most of the developers get fedup of the MaintainScrollPositionOnPostback, Because most of the time it doesn't work in our applications..
There are several solutions the experts have found. the idea is to Preserve Scroll position on Postback then on the Page_Load give the Position back again to the Scroll.
See this Post I've answered on forums : http://forums.asp.net/t/1829113.aspx
Most of the times on Validation Summary Error the Page go to PostBack and the Scroll Jump to the top of the Page.
HTML Markup!
<asp:button id="Button1" runat="server" text="submit"> <asp:hiddenfield id="__SCROLLPOSITIONX" runat="server"> <asp:hiddenfield id="__SCROLLPOSITIONY" runat="server"> </asp:hiddenfield></asp:hiddenfield></asp:button>
C# CodeBehind Page_Load
protected void Page_Load(object sender, EventArgs e) { string script = @" theForm = document.forms[0]; if (!theForm) { theForm = document.form1; } theForm.__SCROLLPOSITIONX.value = getScrollX(); theForm.__SCROLLPOSITIONY.value = getScrollY();"; this.ClientScript.RegisterOnSubmitStatement(this.GetType(), "sumbit", script); }
Good Luck, guys hope it will help you! Comments if it helped..
0 comments:
Post a Comment