System.Web.UI.WebControls.WebControl.AddAttributesToRender C# (CSharp) Method

AddAttributesToRender() protected method

protected AddAttributesToRender ( System.Web.UI.HtmlTextWriter writer ) : void
writer System.Web.UI.HtmlTextWriter
return void
		protected virtual void AddAttributesToRender (HtmlTextWriter writer) 
		{
			if (ID != null)
				writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID);

			if (AccessKey != string.Empty)
				writer.AddAttribute (HtmlTextWriterAttribute.Accesskey, AccessKey);

			if (!IsEnabled)
				writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled", false);

			if (ToolTip != string.Empty)
				writer.AddAttribute (HtmlTextWriterAttribute.Title, ToolTip);

			if (TabIndex != 0)
				writer.AddAttribute (HtmlTextWriterAttribute.Tabindex, TabIndex.ToString ());

			if (style != null && !style.IsEmpty) {
#if NET_2_0
				//unbelievable, but see WebControlTest.RenderBeginTag_BorderWidth_xxx
				if (TagKey == HtmlTextWriterTag.Span)
					AddDisplayStyleAttribute (writer);
#endif
				style.AddAttributesToRender(writer, this);
			}

			if (attributes != null)
				foreach(string s in attributes.Keys)
					writer.AddAttribute (s, attributes [s]);
		}