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

AddAttributesToRender() protected method

protected AddAttributesToRender ( HtmlTextWriter writer ) : void
writer HtmlTextWriter
return void
		protected override void AddAttributesToRender (HtmlTextWriter writer)
		{
			/* if we're rendering uplevel, add our attributes */
			if (render_uplevel) {
				/* force an ID here if we weren't assigned one */
				if (ID == null)
					writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID);

				if (ControlToValidate != String.Empty)
#if NET_2_0
					RegisterExpandoAttribute (ClientID, "controltovalidate", GetControlRenderID (ControlToValidate));
#else
					writer.AddAttribute ("controltovalidate", GetControlRenderID (ControlToValidate));
#endif

				if (ErrorMessage != String.Empty)
#if NET_2_0
					RegisterExpandoAttribute (ClientID, "errormessage", ErrorMessage, true);
#else
					writer.AddAttribute ("errormessage", ErrorMessage);

				if (Text != String.Empty)
					writer.AddAttribute ("text", Text);
#endif

#if NET_2_0
				if (ValidationGroup != String.Empty)
					RegisterExpandoAttribute (ClientID, "validationGroup", ValidationGroup, true);

				if (SetFocusOnError)
					RegisterExpandoAttribute (ClientID, "focusOnError", "t");
#endif
				if (!IsEnabled)
#if NET_2_0
					RegisterExpandoAttribute (ClientID, "enabled", "False");
#else
					writer.AddAttribute ("enabled", "false", false);
#endif

#if NET_2_0
				if (IsEnabled && !IsValid) {
					RegisterExpandoAttribute (ClientID, "isvalid", "False");
#else
				if (!IsValid) {
					writer.AddAttribute ("isvalid", "false", false);
#endif
				}
				else {
					if (Display == ValidatorDisplay.Static)
						writer.AddStyleAttribute ("visibility", "hidden");
					else
						writer.AddStyleAttribute ("display", "none");
				}

				if (Display != ValidatorDisplay.Static)
#if NET_2_0
					RegisterExpandoAttribute (ClientID, "display", Display.ToString ());
#else
					writer.AddAttribute ("display", Display.ToString());
#endif
			}

			base.AddAttributesToRender (writer);
		}

#if NET_2_0
		internal void RegisterExpandoAttribute (string controlId, string attributeName, string attributeValue) {
			RegisterExpandoAttribute (controlId, attributeName, attributeValue, false);
		}