X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem.Web%2FSystem.Web.UI.HtmlControls%2FHtmlInputCheckBox.cs;h=59eefc7a12f291657a069821fdf8480f86b5ed32;hb=3c7cc372ab2304cb8eeb18b4373ef5c4b3b2a5f0;hp=a0981cfa2079264ef438223dacc1d0310e057956;hpb=64f85a65b023522d3f34e9932e6a843e0ad8fc3b;p=mono.git diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs index a0981cfa207..59eefc7a12f 100644 --- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs +++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs @@ -4,7 +4,7 @@ // Author: // Dick Porter // -// Copyright (C) 2005 Novell, Inc (http://www.novell.com) +// Copyright (C) 2005-2010 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -37,11 +37,11 @@ namespace System.Web.UI.HtmlControls [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)] // attributes [DefaultEvent ("ServerChange")] -#if NET_2_0 [SupportsEventValidation] -#endif public class HtmlInputCheckBox : HtmlInputControl, IPostBackDataHandler { + static readonly object EventServerChange = new object (); + public HtmlInputCheckBox () : base ("checkbox") { } @@ -50,11 +50,8 @@ namespace System.Web.UI.HtmlControls [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] [WebSysDescription("")] [WebCategory("Misc")] -#if NET_2_0 [TypeConverter (typeof(MinimizableAttributeTypeConverter))] -#endif - public bool Checked - { + public bool Checked { get { string check = Attributes["checked"]; @@ -72,13 +69,10 @@ namespace System.Web.UI.HtmlControls } } } - - private static readonly object EventServerChange = new object (); [WebSysDescription("")] [WebCategory("Action")] - public event EventHandler ServerChange - { + public event EventHandler ServerChange { add { Events.AddHandler (EventServerChange, value); } @@ -87,17 +81,22 @@ namespace System.Web.UI.HtmlControls } } -#if NET_2_0 - protected internal -#else - protected -#endif - override void OnPreRender (EventArgs e) + protected override void RenderAttributes (HtmlTextWriter writer) + { + Page page = Page; + if (page != null) + page.ClientScript.RegisterForEventValidation (UniqueID); + base.RenderAttributes (writer); + } + + protected internal override void OnPreRender (EventArgs e) { base.OnPreRender (e); - if (Page != null) { - Page.RegisterRequiresPostBack (this); + Page page = Page; + if (page != null && !Disabled) { + page.RegisterRequiresPostBack (this); + page.RegisterEnabledControl (this); } } @@ -105,9 +104,8 @@ namespace System.Web.UI.HtmlControls { EventHandler handler = (EventHandler)Events[EventServerChange]; - if (handler != null) { + if (handler != null) handler (this, e); - } } bool LoadPostDataInternal (string postDataKey, NameValueCollection postCollection) @@ -129,7 +127,6 @@ namespace System.Web.UI.HtmlControls OnServerChange (EventArgs.Empty); } -#if NET_2_0 protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection) { return LoadPostDataInternal (postDataKey, postCollection); @@ -137,26 +134,18 @@ namespace System.Web.UI.HtmlControls protected virtual void RaisePostDataChangedEvent () { + ValidateEvent (UniqueID, String.Empty); RaisePostDataChangedEventInternal (); } -#endif bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection) { -#if NET_2_0 return LoadPostData (postDataKey, postCollection); -#else - return LoadPostDataInternal (postDataKey, postCollection); -#endif } void IPostBackDataHandler.RaisePostDataChangedEvent () { -#if NET_2_0 RaisePostDataChangedEvent(); -#else - RaisePostDataChangedEventInternal (); -#endif } } }