Kaynağa Gözat

make rendering of the onclick attribute to consider ValidationGroup property

svn path=/trunk/mcs/; revision=65538
Igor Zelmanovich 19 yıl önce
ebeveyn
işleme
fa9dde8d8e

+ 5 - 0
mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog

@@ -1,3 +1,8 @@
+2006-09-17  Igor Zelmanovich  <[email protected]>
+
+	* HtmlInputImage.cs: 
+	make rendering of the onclick attribute to consider ValidationGroup property	
+
 2006-09-17  Igor Zelmanovich  <[email protected]>
 
 	* HtmlInputButton.cs: 

+ 7 - 0
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputImage.cs

@@ -245,10 +245,17 @@ namespace System.Web.UI.HtmlControls {
 
 		protected override void RenderAttributes (HtmlTextWriter writer)
 		{
+#if NET_2_0
+			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);
 		}

+ 4 - 0
mcs/class/System.Web/System.Web.UI/ChangeLog

@@ -1,3 +1,7 @@
+2006-19-17 Igor Zelmanovich <[email protected]>
+
+	* ClientScriptManager.cs: added helper method
+
 2006-09-14 Igor Zelmanovich <[email protected]>
 
 	* Page.cs: fixed: GetValidators(string), Validate(string) works properly

+ 6 - 0
mcs/class/System.Web/System.Web.UI/ClientScriptManager.cs

@@ -389,6 +389,12 @@ namespace System.Web.UI
 			}
 		}
 
+#if NET_2_0
+		internal string GetClientValidationEvent (string validationGroup) {
+			return "if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate('" + validationGroup + "');";
+		}
+#endif
+
 		internal string GetClientValidationEvent ()
 		{
 			return "if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate();";