From 26e133c6499135531a32a75bf3bdc6876000f14d Mon Sep 17 00:00:00 2001 From: Igor Zelmanovich Date: Thu, 30 Aug 2007 08:31:00 +0000 Subject: [PATCH] 2007-08-30 Igor Zelmanovich * Page.cs: fixed MaintainScrollPositionOnPostBack feature. 2007-08-30 Igor Zelmanovich * webform.js: fixed MaintainScrollPositionOnPostBack feature. svn path=/trunk/mcs/; revision=85037 --- mcs/class/System.Web/System.Web.UI/ChangeLog | 4 +++ mcs/class/System.Web/System.Web.UI/Page.cs | 10 +++--- mcs/class/System.Web/resources/ChangeLog | 4 +++ mcs/class/System.Web/resources/webform.js | 33 ++++++++++---------- 4 files changed, 30 insertions(+), 21 deletions(-) diff --git a/mcs/class/System.Web/System.Web.UI/ChangeLog b/mcs/class/System.Web/System.Web.UI/ChangeLog index 0b0ae185c2c..61ca83478cd 100644 --- a/mcs/class/System.Web/System.Web.UI/ChangeLog +++ b/mcs/class/System.Web/System.Web.UI/ChangeLog @@ -1,3 +1,7 @@ +2007-08-30 Igor Zelmanovich + + * Page.cs: fixed MaintainScrollPositionOnPostBack feature. + 2007-08-29 Marek Habersack * TemplateBuilder.cs: check for and store for later use the diff --git a/mcs/class/System.Web/System.Web.UI/Page.cs b/mcs/class/System.Web/System.Web.UI/Page.cs index d96a73c7b37..45164a5f671 100644 --- a/mcs/class/System.Web/System.Web.UI/Page.cs +++ b/mcs/class/System.Web/System.Web.UI/Page.cs @@ -954,17 +954,19 @@ public partial class Page : TemplateControl, IHttpHandler ClientScript.RegisterHiddenField (ScrollPositionXID, Request [ScrollPositionXID]); ClientScript.RegisterHiddenField (ScrollPositionYID, Request [ScrollPositionYID]); - + + string webForm = IsMultiForm ? theForm + "." : null; + StringBuilder script = new StringBuilder (); script.AppendLine (""); diff --git a/mcs/class/System.Web/resources/ChangeLog b/mcs/class/System.Web/resources/ChangeLog index 50ead0b8d9c..ffeca384dcf 100644 --- a/mcs/class/System.Web/resources/ChangeLog +++ b/mcs/class/System.Web/resources/ChangeLog @@ -1,3 +1,7 @@ +2007-08-30 Igor Zelmanovich + + * webform.js: fixed MaintainScrollPositionOnPostBack feature. + 2007-08-19 Marek Habersack * webform.js: __doPostBack is a function defined in the self diff --git a/mcs/class/System.Web/resources/webform.js b/mcs/class/System.Web/resources/webform.js index 834231c97e9..11c5682f334 100644 --- a/mcs/class/System.Web/resources/webform.js +++ b/mcs/class/System.Web/resources/webform.js @@ -274,37 +274,36 @@ webForm.WebForm_FireDefaultButton = function (event, target) webForm.WebForm_SaveScrollPositionSubmit = function () { - var pos = WebForm_GetElementPosition(this); - this.elements['__SCROLLPOSITIONX'].value = WebForm_GetScrollX() - pos.x; - this.elements['__SCROLLPOSITIONY'].value = WebForm_GetScrollY() - pos.y; - if ((typeof(this.oldSubmit) != "undefined") && (this.oldSubmit != null)) { - return this.oldSubmit(); + var pos = this.WebForm_GetElementPosition(this._form); + this._form.elements['__SCROLLPOSITIONX'].value = this.WebForm_GetScrollX() - pos.x; + this._form.elements['__SCROLLPOSITIONY'].value = this.WebForm_GetScrollY() - pos.y; + if ((typeof(this._form.oldSubmit) != "undefined") && (this._form.oldSubmit != null)) { + return this._form.oldSubmit(); } return true; } webForm.WebForm_SaveScrollPositionOnSubmit = function () { - var pos = WebForm_GetElementPosition(this); - this.elements['__SCROLLPOSITIONX'].value = WebForm_GetScrollX() - pos.x; - this.elements['__SCROLLPOSITIONY'].value = WebForm_GetScrollY() - pos.y; - if ((typeof(this.oldOnSubmit) != "undefined") && (this.oldOnSubmit != null)) { - return this.oldOnSubmit(); + var pos = this.WebForm_GetElementPosition(this._form); + this._form.elements['__SCROLLPOSITIONX'].value = this.WebForm_GetScrollX() - pos.x; + this._form.elements['__SCROLLPOSITIONY'].value = this.WebForm_GetScrollY() - pos.y; + if ((typeof(this._form.oldOnSubmit) != "undefined") && (this._form.oldOnSubmit != null)) { + return this._form.oldOnSubmit(); } return true; } -webForm.WebForm_RestoreScrollPosition = function (currForm) +webForm.WebForm_RestoreScrollPosition = function () { - currForm = currForm || theForm; - var pos = WebForm_GetElementPosition(currForm); - var ScrollX = parseInt(currForm.elements['__SCROLLPOSITIONX'].value); - var ScrollY = parseInt(currForm.elements['__SCROLLPOSITIONY'].value); + var pos = this.WebForm_GetElementPosition(this._form); + var ScrollX = parseInt(this._form.elements['__SCROLLPOSITIONX'].value); + var ScrollY = parseInt(this._form.elements['__SCROLLPOSITIONY'].value); ScrollX = (isNaN(ScrollX)) ? pos.x : (ScrollX + pos.x); ScrollY = (isNaN(ScrollY)) ? pos.y : (ScrollY + pos.y); window.scrollTo(ScrollX, ScrollY); - if ((typeof(currForm.oldOnLoad) != "undefined") && (currForm.oldOnLoad != null)) { - return currForm.oldOnLoad(); + if ((typeof(this._form.oldOnLoad) != "undefined") && (this._form.oldOnLoad != null)) { + return this._form.oldOnLoad(); } return true; } -- 2.25.1