//\r
\r
using System;\r
+using System.ComponentModel;
+using System.ComponentModel.Design;\r
using System.Globalization;\r
using System.Web;\r
using System.Web.UI;\r
\r
namespace System.Web.UI.HtmlControls{\r
\r
+ [ToolboxItem(false)]
+ [Designer ("System.Web.UI.Design.HtmlIntrinsicControlDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]\r
public abstract class HtmlControl : Control, IAttributeAccessor\r
{\r
- private string _tagName = "span";\r
- //TODO: Is this correct, or is the StateBag really the ViewState?\r
- private AttributeCollection _attributes = new AttributeCollection(new StateBag(true));\r
- private bool _disabled = false;\r
+ internal string _tagName;\r
+ private AttributeCollection _attributes;\r
+
\r
public HtmlControl() : this ("span") {}\r
\r
try{\r
attr = ResolveUrl(attr);\r
}\r
- catch (Exception e) {\r
+ catch (Exception) {\r
throw new HttpException(attribName + " property had malformed url");\r
}\r
writer.WriteAttribute(attribName, attr);\r
Attributes.Render(writer);\r
}\r
\r
+ [Browsable(false)]\r
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]\r
public AttributeCollection Attributes\r
{\r
- get { return _attributes; }\r
+ get { \r
+ if (_attributes == null)\r
+ _attributes = new AttributeCollection (ViewState);\r
+ return _attributes;\r
+ }\r
}\r
\r
+ [DefaultValue("")]\r
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]\r
+ [WebCategory("Behavior")]\r
public bool Disabled\r
{\r
- get { return _disabled; }\r
- set { _disabled = value; }\r
+ get {
+ string disableAttr = Attributes["disabled"] as string;
+ return (disableAttr != null);
+ }\r
+ set {
+ if (!value)
+ Attributes.Remove ("disabled");
+ else
+ Attributes["disabled"] = "disabled";
+ }\r
}\r
\r
+ [Browsable(false)]\r
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]\r
public CssStyleCollection Style\r
{\r
- get { return _attributes.CssStyle; }\r
+ get { return Attributes.CssStyle; }\r
}\r
\r
+ [DefaultValue("")]\r
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]\r
+ [WebCategory("Appearance")]\r
public virtual string TagName\r
{\r
get { return _tagName; }\r