From da27ee2dbb2943883bb325a354ba7b75b6ed4458 Mon Sep 17 00:00:00 2001 From: Alon Gazit Date: Sun, 14 Dec 2003 16:44:08 +0000 Subject: The problem was in HtmlInputButton.RenderAttributes(). Before adding the script to the HTML, the number of Validators should be checked. svn path=/trunk/mcs/; revision=21119 --- .../System.Web.UI.HtmlControls/HtmlInputButton.cs | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs') diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs index ecd437a237e..7be2fd546b8 100755 --- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs +++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs @@ -33,20 +33,23 @@ namespace System.Web.UI.HtmlControls{ { if (Page != null && CausesValidation) { string type = Type; + Console.WriteLine(type); if (String.Compare (type, "button", true) == 0 || String.Compare (type, "submit", true) == 0) { string script = Page.GetPostBackClientEvent (this, String.Empty); - AttributeCollection coll = Attributes; - if (coll ["language"] != null) - coll.Remove ("language"); - writer.WriteAttribute ("language", "javascript"); + if (script != null && Page.Validators.Count > 0){ + AttributeCollection coll = Attributes; + if (coll ["language"] != null) + coll.Remove ("language"); + writer.WriteAttribute ("language", "javascript"); - string onclick; - if ((onclick = coll ["onclick"]) != null) { - script = onclick + " " + script; - coll.Remove ("onclick"); + string onclick; + if ((onclick = coll ["onclick"]) != null) { + script = onclick + " " + script; + coll.Remove ("onclick"); + } + + writer.WriteAttribute ("onclick", script); } - - writer.WriteAttribute ("onclick", script); } } -- cgit v1.2.3