// Author:
// Dick Porter <dick@ximian.com>
//
-// 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
[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")
{
}
[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"];
}
}
}
-
- private static readonly object EventServerChange = new object ();
[WebSysDescription("")]
[WebCategory("Action")]
- public event EventHandler ServerChange
- {
+ public event EventHandler ServerChange {
add {
Events.AddHandler (EventServerChange, value);
}
}
}
-#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);
}
}
{
EventHandler handler = (EventHandler)Events[EventServerChange];
- if (handler != null) {
+ if (handler != null)
handler (this, e);
- }
}
bool LoadPostDataInternal (string postDataKey, NameValueCollection postCollection)
OnServerChange (EventArgs.Empty);
}
-#if NET_2_0
protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
{
return LoadPostDataInternal (postDataKey, postCollection);
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
}
}
}