2007-02-14 Igor Zelmanovich <igorz@mainsoft.com>
authorIgor Zelmanovich <igorz@mono-cvs.ximian.com>
Mon, 19 Feb 2007 10:19:11 +0000 (10:19 -0000)
committerIgor Zelmanovich <igorz@mono-cvs.ximian.com>
Mon, 19 Feb 2007 10:19:11 +0000 (10:19 -0000)
* Page.cs: for 2.0: refactoring:
prepare infrastructure for Form.SubmitDisabledControls feature

2007-02-19  Igor Zelmanovich  <igorz@mainsoft.com>

* HtmlInputCheckBox.cs:
* HtmlInputControl.cs:
* HtmlInputHidden.cs:
* HtmlInputRadioButton.cs:
* HtmlInputText.cs:
* HtmlSelect.cs:
* HtmlTextArea.cs:
fixed: Form.SubmitDisabledControls feature:
not all HtmlInputControl need to be reenabled on client.

svn path=/trunk/mcs/; revision=73102

mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputControl.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputHidden.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputRadioButton.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputText.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTextArea.cs
mcs/class/System.Web/System.Web.UI/ChangeLog
mcs/class/System.Web/System.Web.UI/Page.cs

index 9c5a4ced2c2f2b2efffd14339db9e8f59fb1e4f0..24957e1b017913de08071efac2785c1acc949d51 100644 (file)
@@ -1,3 +1,15 @@
+2007-02-19  Igor Zelmanovich  <igorz@mainsoft.com>
+
+       * HtmlInputCheckBox.cs:
+       * HtmlInputControl.cs:
+       * HtmlInputHidden.cs:
+       * HtmlInputRadioButton.cs:
+       * HtmlInputText.cs:
+       * HtmlSelect.cs:
+       * HtmlTextArea.cs:
+       fixed: Form.SubmitDisabledControls feature:     
+       not all HtmlInputControl need to be reenabled on client.                  
+
 2007-02-18  Eyal Alaluf <eyala@mainsoft.com>
 
        * HtmlForm.cs: Under TARGET_J2EE use Page.RenderResponse instead of
index 23dd7345a2382b924be1016410531c4645134731..b6df75e6386971eb48ba78cd01743551312715c9 100644 (file)
@@ -108,6 +108,10 @@ namespace System.Web.UI.HtmlControls
                        if (Page != null) {
                                Page.RegisterRequiresPostBack (this);
                        }
+#if NET_2_0
+                       if (Page != null && !Disabled)
+                               Page.RegisterEnabledControl (this);
+#endif
                }
 
                protected virtual void OnServerChange (EventArgs e)
index 7eab6cfecac2b807e1759aad58675573babc3687..aa1370ed01f052a12bed30bd35d5886a25b6fb0a 100644 (file)
@@ -92,12 +92,8 @@ namespace System.Web.UI.HtmlControls {
                        }
                        base.RenderAttributes (writer);
                        writer.Write (" /");
-
-#if NET_2_0
-                       if (Page != null && Page.Form != null && Page.Form.SubmitDisabledControls && Page.Form.DetermineRenderUplevel() && !Disabled)
-                               Page.ClientScript.RegisterArrayDeclaration ("__enabledControlArray", String.Format ("'{0}'", ClientID));
-#endif
                }
        }
 }
 
+
index efb5df3931445962a114a49469dc726f63300232..65de4f140c8fdddc924c3b4f993cef9fca012313 100644 (file)
@@ -113,6 +113,10 @@ namespace System.Web.UI.HtmlControls {
                        if (Page != null) {
                                Page.RegisterRequiresPostBack (this);
                        }
+#if NET_2_0
+                       if (Page != null && !Disabled)
+                               Page.RegisterEnabledControl (this);
+#endif
                }
 
                protected virtual void OnServerChange (EventArgs e)
index 677bf5ceb85a0664baed53e51e0be8f7c7502644..53ab8b1243550d65380c4c26da886277ae12b222 100644 (file)
@@ -108,6 +108,10 @@ namespace System.Web.UI.HtmlControls {
                        if (Page != null) {
                                Page.RegisterRequiresPostBack (this);
                        }
+#if NET_2_0
+                       if (Page != null && !Disabled)
+                               Page.RegisterEnabledControl (this);
+#endif
                }
 
                protected virtual void OnServerChange (EventArgs e)
index 43f777609471822d2f502b68214096e74134706e..49282672548a2b0183eac04b500562ab69a7f561 100644 (file)
@@ -129,6 +129,10 @@ namespace System.Web.UI.HtmlControls {
                        if (Page != null) {
                                Page.RegisterRequiresPostBack (this);
                        }
+#if NET_2_0
+                       if (Page != null && !Disabled)
+                               Page.RegisterEnabledControl (this);
+#endif
                }
 
                protected virtual void OnServerChange (EventArgs e)
index d02de70ffda37a66d186a2e7e4b55cbe1400fc5d..46918dc3e34908944b07f904d211eb85b1f685bf 100644 (file)
@@ -595,6 +595,10 @@ namespace System.Web.UI.HtmlControls
                        if (Page != null) {
                                Page.RegisterRequiresPostBack (this);
                        }
+#if NET_2_0
+                       if (Page != null && !Disabled)
+                               Page.RegisterEnabledControl (this);
+#endif
                }
 
                protected virtual void OnServerChange (EventArgs e)
index 62eda3162e201cd32e9f16b28000690fe5a1c9e7..09203fc6768185fe30ab88553be07fb1d7f4a8ef 100644 (file)
@@ -126,6 +126,10 @@ namespace System.Web.UI.HtmlControls {
                        if (Page != null) {
                                Page.RegisterRequiresPostBack (this);
                        }
+#if NET_2_0
+                       if (Page != null && !Disabled)
+                               Page.RegisterEnabledControl (this);
+#endif
                }
 
                protected virtual void OnServerChange (EventArgs e)
index d8bf5cda01dfbf72f9eaaad02efed9922f6318be..734b6ac2c5108072a61a36446d2057da4ea22680 100644 (file)
@@ -1,3 +1,8 @@
+2007-02-14 Igor Zelmanovich <igorz@mainsoft.com>
+
+       * Page.cs: for 2.0: refactoring:
+       prepare infrastructure for Form.SubmitDisabledControls feature   
+
 2007-02-18  Eyal Alaluf <eyala@mainsoft.com>
 
        * Control.jvm.cs, Control.cs: Move TemplateSourceDirectory to .jvm file.
index 3d614486695732939ea65506a66b54ce184c1c6a..adb200c9236b36f4f2b05e6484c48c26fe464979 100644 (file)
@@ -76,6 +76,7 @@ public partial class Page : TemplateControl, IHttpHandler
        private object [] _savedControlState;
        private bool _doLoadPreviousPage;
        string _focusedControlID;
+       bool _hasEnabledControlArray;
 #endif
        private bool _viewState = true;
        private bool _viewStateMac;
@@ -121,6 +122,7 @@ public partial class Page : TemplateControl, IHttpHandler
 #if NET_2_0
        const string ScrollPositionXID = "__SCROLLPOSITIONX";
        const string ScrollPositionYID = "__SCROLLPOSITIONY";
+       const string EnabledControlArrayID = "__enabledControlArray";
 #endif
 
 #if NET_2_0
@@ -1808,11 +1810,8 @@ public partial class Page : TemplateControl, IHttpHandler
                                _focusedControlID = Form.DefaultButton;
                }
 
-               if (!String.IsNullOrEmpty (_focusedControlID) || Form.SubmitDisabledControls) {
-
-                       ClientScript.RegisterWebFormClientScript ();
-
                        if (!String.IsNullOrEmpty (_focusedControlID)) {
+                               ClientScript.RegisterWebFormClientScript ();
                                ClientScript.RegisterStartupScript ("HtmlForm-DefaultButton-StartupScript",
                                                                         String.Format ("<script type=\"text/javascript\">\n" +
                                                                                        "<!--\n" +
@@ -1820,11 +1819,19 @@ public partial class Page : TemplateControl, IHttpHandler
                                                                                        "</script>\n", _focusedControlID));
                        }
 
-                       if (Form.SubmitDisabledControls) {
+                       if (Form.SubmitDisabledControls && _hasEnabledControlArray) {
+                               ClientScript.RegisterWebFormClientScript ();
                                ClientScript.RegisterOnSubmitStatement ("HtmlForm-SubmitDisabledControls-SubmitStatement",
                                                                                 "WebForm_ReEnableControls(this);");
                        }
-               }
+       }
+
+       internal void RegisterEnabledControl (Control control)
+       {
+               if (Form == null || !Page.Form.SubmitDisabledControls || !Page.Form.DetermineRenderUplevel ())
+                       return;
+               _hasEnabledControlArray = true;
+               Page.ClientScript.RegisterArrayDeclaration (EnabledControlArrayID, String.Format ("'{0}'", control.ClientID));
        }
        
        protected virtual void OnSaveStateComplete (EventArgs e)