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

AddAttributesToRender() protected method

protected AddAttributesToRender ( System.Web.UI.HtmlTextWriter writer ) : void
writer System.Web.UI.HtmlTextWriter
return void
		protected override void AddAttributesToRender (HtmlTextWriter writer)
		{			
			Page page = Page;
			if (page != null)
				page.VerifyRenderingInServerForm (this);
			
			writer.AddAttribute (HtmlTextWriterAttribute.Type, "image", false);
			writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);

			base.AddAttributesToRender (writer);

			string onclick = OnClientClick;
			if (!String.IsNullOrEmpty (onclick))
				onclick = ClientScriptManager.EnsureEndsWithSemicolon (onclick);
			else
				onclick = String.Empty;
			
			if (HasAttributes && Attributes ["onclick"] != null) {
				onclick = ClientScriptManager.EnsureEndsWithSemicolon (onclick + Attributes ["onclick"]);
				Attributes.Remove ("onclick");
			}
			
			if (page != null)
				onclick += GetClientScriptEventReference ();
			
			if (onclick.Length > 0)
				writer.AddAttribute (HtmlTextWriterAttribute.Onclick, onclick);
		}