//\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(){}\r
+ public HtmlControl() : this ("span") {}\r
\r
public HtmlControl(string tag)\r
{\r
- if(tag != null && tag != String.Empty) _tagName = tag;\r
+ _tagName = tag;\r
}\r
\r
+ protected override ControlCollection CreateControlCollection ()\r
+ {\r
+ return new EmptyControlCollection (this);\r
+ }\r
+\r
internal static string AttributeToString(int n){\r
if (n != -1)return n.ToString(NumberFormatInfo.InvariantInfo);\r
return null;\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
}\r
+\r
+ protected override bool ViewStateIgnoresCase \r
+ {\r
+ get {\r
+ return true;\r
+ }\r
+ }\r
}\r
}\r