Author: igorz
Date: 2007-08-30 04:31:00 -0400 (Thu, 30 Aug 2007)
New Revision: 85037
Modified:
trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
trunk/mcs/class/System.Web/System.Web.UI/Page.cs
trunk/mcs/class/System.Web/resources/ChangeLog
trunk/mcs/class/System.Web/resources/webform.js
Log:
2007-08-30 Igor Zelmanovich <[EMAIL PROTECTED]>
* Page.cs: fixed MaintainScrollPositionOnPostBack feature.
2007-08-30 Igor Zelmanovich <[EMAIL PROTECTED]>
* webform.js: fixed MaintainScrollPositionOnPostBack feature.
Modified: trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/ChangeLog 2007-08-30 07:48:34 UTC
(rev 85036)
+++ trunk/mcs/class/System.Web/System.Web.UI/ChangeLog 2007-08-30 08:31:00 UTC
(rev 85037)
@@ -1,3 +1,7 @@
+2007-08-30 Igor Zelmanovich <[EMAIL PROTECTED]>
+
+ * Page.cs: fixed MaintainScrollPositionOnPostBack feature.
+
2007-08-29 Marek Habersack <[EMAIL PROTECTED]>
* TemplateBuilder.cs: check for and store for later use the
Modified: trunk/mcs/class/System.Web/System.Web.UI/Page.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/Page.cs 2007-08-30 07:48:34 UTC
(rev 85036)
+++ trunk/mcs/class/System.Web/System.Web.UI/Page.cs 2007-08-30 08:31:00 UTC
(rev 85037)
@@ -954,17 +954,19 @@
ClientScript.RegisterHiddenField (ScrollPositionXID,
Request [ScrollPositionXID]);
ClientScript.RegisterHiddenField (ScrollPositionYID,
Request [ScrollPositionYID]);
-
+
+ string webForm = IsMultiForm ? theForm + "." : null;
+
StringBuilder script = new StringBuilder ();
script.AppendLine ("<script type=\"text/javascript\">");
script.AppendLine ("<!--");
script.AppendLine (theForm + ".oldSubmit = " + theForm
+ ".submit;");
- script.AppendLine (theForm + ".submit =
WebForm_SaveScrollPositionSubmit;");
+ script.AppendLine (theForm + ".submit = function () { "
+ webForm + "WebForm_SaveScrollPositionSubmit(); }");
script.AppendLine (theForm + ".oldOnSubmit = " +
theForm + ".onsubmit;");
- script.AppendLine (theForm + ".onsubmit =
WebForm_SaveScrollPositionOnSubmit;");
+ script.AppendLine (theForm + ".onsubmit = function () {
" + webForm + "WebForm_SaveScrollPositionOnSubmit(); }");
if (IsPostBack) {
script.AppendLine (theForm + ".oldOnLoad =
window.onload;");
- script.AppendLine ("window.onload = function ()
{ WebForm_RestoreScrollPosition (" + theForm + "); };");
+ script.AppendLine ("window.onload = function ()
{ " + webForm + "WebForm_RestoreScrollPosition (); };");
}
script.AppendLine ("// -->");
script.AppendLine ("</script>");
Modified: trunk/mcs/class/System.Web/resources/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/resources/ChangeLog 2007-08-30 07:48:34 UTC
(rev 85036)
+++ trunk/mcs/class/System.Web/resources/ChangeLog 2007-08-30 08:31:00 UTC
(rev 85037)
@@ -1,3 +1,7 @@
+2007-08-30 Igor Zelmanovich <[EMAIL PROTECTED]>
+
+ * webform.js: fixed MaintainScrollPositionOnPostBack feature.
+
2007-08-19 Marek Habersack <[EMAIL PROTECTED]>
* webform.js: __doPostBack is a function defined in the self
Modified: trunk/mcs/class/System.Web/resources/webform.js
===================================================================
--- trunk/mcs/class/System.Web/resources/webform.js 2007-08-30 07:48:34 UTC
(rev 85036)
+++ trunk/mcs/class/System.Web/resources/webform.js 2007-08-30 08:31:00 UTC
(rev 85037)
@@ -274,37 +274,36 @@
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;
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches