Author: igorz
Date: 2006-09-17 08:47:35 -0400 (Sun, 17 Sep 2006)
New Revision: 65536
Modified:
trunk/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog
trunk/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs
Log:
make rendering of the onclick attribute to consider ValidationGroup property
Modified: trunk/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog
2006-09-17 12:27:59 UTC (rev 65535)
+++ trunk/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog
2006-09-17 12:47:35 UTC (rev 65536)
@@ -1,5 +1,10 @@
2006-09-17 Igor Zelmanovich <[EMAIL PROTECTED]>
+ * HtmlInputButton.cs:
+ make rendering of the onclick attribute to consider ValidationGroup
property
+
+2006-09-17 Igor Zelmanovich <[EMAIL PROTECTED]>
+
* HtmlAnchor.cs:
implemented CausesValidation and ValidationGroup properties
Modified:
trunk/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs
2006-09-17 12:27:59 UTC (rev 65535)
+++ trunk/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs
2006-09-17 12:47:35 UTC (rev 65536)
@@ -141,6 +141,7 @@
server_click (this, e);
}
+#if !NET_2_0
bool RenderOnClick ()
{
if (Page == null || !CausesValidation)
@@ -158,9 +159,33 @@
return false;
}
+#endif
protected override void RenderAttributes (HtmlTextWriter writer)
{
+#if NET_2_0
+ CultureInfo inv = CultureInfo.InvariantCulture;
+ string input_type = Type;
+ if (0 != String.Compare (input_type, "reset", true,
inv) &&
+ ((0 == String.Compare (input_type, "submit",
true, inv)) ||
+ (0 == String.Compare (input_type, "button",
true, inv) && Events [ServerClickEvent] != null))) {
+
+ string onclick = String.Empty;
+ if (Attributes ["onclick"] != null) {
+ onclick =
ClientScriptManager.EnsureEndsWithSemicolon (Attributes ["onclick"] + onclick);
+ Attributes.Remove ("onclick");
+ }
+ if (Page != null) {
+ PostBackOptions options =
GetPostBackOptions ();
+ onclick +=
Page.ClientScript.GetPostBackEventReference (options);
+ }
+
+ if (onclick.Length > 0) {
+ writer.WriteAttribute ("onclick",
onclick);
+ writer.WriteAttribute ("language",
"javascript");
+ }
+ }
+#else
if (RenderOnClick ()) {
string oc = null;
ClientScriptManager csm = new
ClientScriptManager (Page);
@@ -175,6 +200,7 @@
writer.WriteAttribute ("onclick", oc);
}
}
+#endif
Attributes.Remove ("CausesValidation");
#if NET_2_0
@@ -187,6 +213,22 @@
base.RenderAttributes (writer);
}
+#if NET_2_0
+ PostBackOptions GetPostBackOptions () {
+ PostBackOptions options = new PostBackOptions (this);
+ options.ValidationGroup = null;
+ options.ActionUrl = null;
+ options.Argument = "";
+ options.RequiresJavaScriptProtocol = false;
+ options.ClientSubmit = (0 != String.Compare (Type,
"submit", true, CultureInfo.InvariantCulture));
+ options.PerformValidation = CausesValidation && Page !=
null && Page.Validators.Count > 0;
+ if (options.PerformValidation)
+ options.ValidationGroup = ValidationGroup;
+
+ return options;
+ }
+#endif
+
[WebSysDescription("")]
[WebCategory("Action")]
public event EventHandler ServerClick {
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches