New test.
[mono.git] / mcs / class / System.Web / System.Web.UI.HtmlControls / HtmlInputImage.cs
index 043cf887e09193b792197c98a701df19ba4db110..9e441310ab7ca4c704d2ea32d1625cbde2c99a56 100644 (file)
@@ -167,7 +167,7 @@ namespace System.Web.UI.HtmlControls {
 
 #if NET_2_0
                [DefaultValue ("")]
-               public string ValidationGroup
+               public virtual string ValidationGroup
                {
                        get {
                                return ViewState.GetString ("ValidationGroup", "");
@@ -245,17 +245,27 @@ namespace System.Web.UI.HtmlControls {
 
                protected override void RenderAttributes (HtmlTextWriter writer)
                {
+#if NET_2_0
+                       if (Page != null)
+                               Page.ClientScript.RegisterForEventValidation (this.UniqueID);
+                       
+                       if (CausesValidation && Page != null && Page.AreValidatorsUplevel (ValidationGroup)) {
+                               ClientScriptManager csm = Page.ClientScript;
+                               Attributes ["onclick"] += csm.GetClientValidationEvent (ValidationGroup);
+                       }
+#else          
                        if (CausesValidation && Page != null && Page.AreValidatorsUplevel ()) {
                                ClientScriptManager csm = new ClientScriptManager (Page);
                                writer.WriteAttribute ("onclick", csm.GetClientValidationEvent ());
                        }
+#endif         
 
                        base.RenderAttributes (writer);
                }
 
                private void SetAtt (string name, string value)
                {
-                       if (value == null)
+                       if ((value == null) || (value.Length == 0))
                                Attributes.Remove (name);
                        else
                                Attributes [name] = value;