oops
[mono.git] / mcs / class / System.Web / System.Web.UI.WebControls / Button.cs
index 0c0200f57678ebce752cd34ac5c5b09f08a58eaa..b1e86f2dc665e6be7894f82dfadac220653f552e 100644 (file)
@@ -89,11 +89,8 @@ namespace System.Web.UI.WebControls {
                [WebCategory ("Behavior")]
 #if NET_2_0
                [Themeable (false)]
-               public virtual
-#else          
-               public
 #endif         
-               string CommandArgument {
+               public string CommandArgument {
                        get {
                                return ViewState.GetString ("CommandArgument", "");
                        }
@@ -107,11 +104,8 @@ namespace System.Web.UI.WebControls {
                [WebCategory ("Behavior")]
 #if NET_2_0
                [Themeable (false)]
-               public virtual
-#else
-               public
 #endif         
-               string CommandName {
+               public string CommandName {
                        get {
                                return ViewState.GetString ("CommandName", "");
                        }
@@ -144,11 +138,8 @@ namespace System.Web.UI.WebControls {
                [WebCategory ("Appearance")]
 #if NET_2_0
                [Localizable (true)]
-               public virtual
-#else          
-               public
 #endif         
-               string Text {
+               public string Text {
                        get {
                                return ViewState.GetString ("Text", "");
                        }
@@ -184,8 +175,15 @@ namespace System.Web.UI.WebControls {
                        writer.AddAttribute (HtmlTextWriterAttribute.Value, Text);
 
                        if (CausesValidation && Page != null && Page.AreValidatorsUplevel ()) {
+                               string onclick = Attributes["onclick"];
+                               if (onclick != null) {
+                                       Attributes.Remove("onclick");
+                                       int len = onclick.Length;
+                                       if (len > 0 && onclick[len - 1] != ';')
+                                               onclick += ";";
+                               }
                                ClientScriptManager csm = new ClientScriptManager (Page);
-                               writer.AddAttribute (HtmlTextWriterAttribute.Onclick, csm.GetClientValidationEvent ());
+                               writer.AddAttribute (HtmlTextWriterAttribute.Onclick, onclick + csm.GetClientValidationEvent ());
                                writer.AddAttribute ("language", "javascript");
                        }
 
@@ -202,15 +200,7 @@ namespace System.Web.UI.WebControls {
 
                void IPostBackEventHandler.RaisePostBackEvent (string eventArgument)
                {
-                       if (CausesValidation)
-#if NET_2_0
-                               Page.Validate (ValidationGroup);
-#else
-                               Page.Validate ();
-#endif
-
-                       OnClick (EventArgs.Empty);
-                       OnCommand (new CommandEventArgs (CommandName, CommandArgument));
+                       RaisePostBackEvent (eventArgument);
                }
 
                protected virtual void OnClick (EventArgs e)
@@ -233,15 +223,22 @@ namespace System.Web.UI.WebControls {
                        RaiseBubbleEvent (this, e);
                }
 
-#if NET_2_0            
-               [MonoTODO]
-               protected virtual void RaisePostBackEvent (string eventArgument)
+#if NET_2_0
+               protected virtual
+#endif
+               void RaisePostBackEvent (string eventArgument)
                {
-                       throw new NotImplementedException ();
+                       if (CausesValidation)
+#if NET_2_0
+                               Page.Validate (ValidationGroup);
+#else
+                               Page.Validate ();
+#endif
+
+                       OnClick (EventArgs.Empty);
+                       OnCommand (new CommandEventArgs (CommandName, CommandArgument));
                }
-#endif         
 
-               [MonoTODO ("why is this here?")]
 #if NET_2_0
                protected internal
 #else          
@@ -249,7 +246,6 @@ namespace System.Web.UI.WebControls {
 #endif         
                override void RenderContents (HtmlTextWriter writer)
                {
-                       base.RenderContents (writer);
                }
 
                [WebSysDescription ("")]
@@ -282,12 +278,12 @@ namespace System.Web.UI.WebControls {
                [Themeable (false)]
                [UrlProperty("*.aspx")]
                [MonoTODO]
-               public string PostBackUrl {
+               public virtual string PostBackUrl {
                        get {
-                               throw new NotImplementedException ();
+                               return ViewState.GetString ("PostBackUrl", "");
                        }
                        set {
-                               throw new NotImplementedException ();
+                               ViewState ["PostBackUrl"] = value;
                        }
                }
 
@@ -295,7 +291,7 @@ namespace System.Web.UI.WebControls {
                [Themeable (false)]
                [WebSysDescription ("")]
                [WebCategoryAttribute ("Behavior")]
-               public string ValidationGroup {
+               public virtual string ValidationGroup {
                        get {
                                return ViewState.GetString ("ValidationGroup", "");
                        }
@@ -307,3 +303,4 @@ namespace System.Web.UI.WebControls {
 
        }
 }
+