protected override void RenderAttributes(HtmlTextWriter writer) { #if NET_2_0 CultureInfo inv = Helpers.InvariantCulture; string input_type = Type; if (0 != String.Compare(input_type, "reset", true, inv) && ((0 == String.Compare(input_type, "submit", true, inv)) || (0 == String.Compare(input_type, "button", true, inv) && Events [ServerClickEvent] != null))) { string onclick = String.Empty; if (Attributes ["onclick"] != null) { onclick = ClientScriptManager.EnsureEndsWithSemicolon(Attributes ["onclick"] + onclick); Attributes.Remove("onclick"); } if (Page != null) { PostBackOptions options = GetPostBackOptions(); onclick += Page.ClientScript.GetPostBackEventReference(options, true); } if (onclick.Length > 0) { writer.WriteAttribute("onclick", onclick, true); writer.WriteAttribute("language", "javascript"); } } #else if (RenderOnClick()) { string oc = null; ClientScriptManager csm = new ClientScriptManager(Page); if (Page.AreValidatorsUplevel()) { oc = csm.GetClientValidationEvent(); } else if (Events [ServerClickEvent] != null) { oc = Attributes ["onclick"] + " " + csm.GetPostBackEventReference(this, ""); } if (oc != null) { writer.WriteAttribute("language", "javascript"); writer.WriteAttribute("onclick", oc, true); } } #endif Attributes.Remove("CausesValidation"); #if NET_2_0 // LAMESPEC: MS doesn't actually remove this //attribute. it shows up in the rendered //output. // Attributes.Remove("ValidationGroup"); #endif base.RenderAttributes(writer); }
protected override void AddAttributesToRender(HtmlTextWriter writer) { if (Page != null) { Page.VerifyRenderingInServerForm(this); } #if NET_2_0 writer.AddAttribute(HtmlTextWriterAttribute.Type, UseSubmitBehavior ? "submit" : "button", false); writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID); writer.AddAttribute(HtmlTextWriterAttribute.Value, Text); string onclick = OnClientClick; onclick = ClientScriptManager.EnsureEndsWithSemicolon(onclick); 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); } #else writer.AddAttribute(HtmlTextWriterAttribute.Type, "submit"); writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID); writer.AddAttribute(HtmlTextWriterAttribute.Value, Text); if (CausesValidation && Page != null && Page.AreValidatorsUplevel()) { string onclick = Attributes["onclick"]; if (onclick != null) { Attributes.Remove("onclick"); int len = onclick.Length; if (len > 0 && onclick[len - 1] != ';') { onclick += ";"; } } ClientScriptManager csm = new ClientScriptManager(Page); writer.AddAttribute(HtmlTextWriterAttribute.Onclick, onclick + csm.GetClientValidationEvent()); writer.AddAttribute("language", "javascript"); } #endif base.AddAttributesToRender(writer); }
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); #if NET_2_0 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); } #else if (CausesValidation && page != null && page.AreValidatorsUplevel()) { ClientScriptManager csm = new ClientScriptManager(page); writer.AddAttribute(HtmlTextWriterAttribute.Onclick, csm.GetClientValidationEvent()); writer.AddAttribute("language", "javascript"); } #endif }
protected override void RenderAttributes(HtmlTextWriter writer) { Page page = Page; if (page != null) { page.ClientScript.RegisterForEventValidation(UniqueID); } if (CausesValidation && page != null && page.AreValidatorsUplevel(ValidationGroup)) { ClientScriptManager csm = page.ClientScript; Attributes ["onclick"] += csm.GetClientValidationEvent(ValidationGroup); } PreProcessRelativeReference(writer, "src"); base.RenderAttributes(writer); }
protected override void RenderAttributes(HtmlTextWriter writer) { #if NET_2_0 if (Page != null) { Page.ClientScript.RegisterForEventValidation(UniqueID); } if (CausesValidation && Page != null && Page.AreValidatorsUplevel(ValidationGroup)) { ClientScriptManager csm = Page.ClientScript; Attributes ["onclick"] += csm.GetClientValidationEvent(ValidationGroup); } #else if (CausesValidation && Page != null && Page.AreValidatorsUplevel()) { ClientScriptManager csm = new ClientScriptManager(Page); writer.WriteAttribute("onclick", csm.GetClientValidationEvent()); } #endif PreProcessRelativeReference(writer, "src"); base.RenderAttributes(writer); }
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); #if NET_2_0 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); #else if (CausesValidation && page != null && page.AreValidatorsUplevel ()) { ClientScriptManager csm = new ClientScriptManager (page); writer.AddAttribute (HtmlTextWriterAttribute.Onclick, csm.GetClientValidationEvent ()); writer.AddAttribute ("language", "javascript"); } #endif }
protected override void RenderAttributes (HtmlTextWriter writer) { #if NET_2_0 CultureInfo inv = Helpers.InvariantCulture; string input_type = Type; if (0 != String.Compare (input_type, "reset", true, inv) && ((0 == String.Compare (input_type, "submit", true, inv)) || (0 == String.Compare (input_type, "button", true, inv) && Events [ServerClickEvent] != null))) { string onclick = String.Empty; if (Attributes ["onclick"] != null) { onclick = ClientScriptManager.EnsureEndsWithSemicolon (Attributes ["onclick"] + onclick); Attributes.Remove ("onclick"); } if (Page != null) { PostBackOptions options = GetPostBackOptions (); onclick += Page.ClientScript.GetPostBackEventReference (options, true); } if (onclick.Length > 0) { writer.WriteAttribute ("onclick", onclick, true); writer.WriteAttribute ("language", "javascript"); } } #else if (RenderOnClick ()) { string oc = null; ClientScriptManager csm = new ClientScriptManager (Page); if (Page.AreValidatorsUplevel ()) { oc = csm.GetClientValidationEvent (); } else if (Events [ServerClickEvent] != null) { oc = Attributes ["onclick"] + " " + csm.GetPostBackEventReference (this, ""); } if (oc != null) { writer.WriteAttribute ("language", "javascript"); writer.WriteAttribute ("onclick", oc, true); } } #endif Attributes.Remove ("CausesValidation"); #if NET_2_0 // LAMESPEC: MS doesn't actually remove this //attribute. it shows up in the rendered //output. // Attributes.Remove("ValidationGroup"); #endif base.RenderAttributes (writer); }
protected override void RenderAttributes (HtmlTextWriter writer) { #if NET_2_0 if (Page != null) Page.ClientScript.RegisterForEventValidation (UniqueID); if (CausesValidation && Page != null && Page.AreValidatorsUplevel (ValidationGroup)) { ClientScriptManager csm = Page.ClientScript; Attributes ["onclick"] += csm.GetClientValidationEvent (ValidationGroup); } #else if (CausesValidation && Page != null && Page.AreValidatorsUplevel ()) { ClientScriptManager csm = new ClientScriptManager (Page); writer.WriteAttribute ("onclick", csm.GetClientValidationEvent ()); } #endif PreProcessRelativeReference (writer,"src"); base.RenderAttributes (writer); }
protected override void AddAttributesToRender (HtmlTextWriter writer) { if (Page != null) Page.VerifyRenderingInServerForm (this); #if NET_2_0 writer.AddAttribute (HtmlTextWriterAttribute.Type, UseSubmitBehavior ? "submit" : "button", false); writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID); writer.AddAttribute (HtmlTextWriterAttribute.Value, Text); string onclick = OnClientClick; onclick = ClientScriptManager.EnsureEndsWithSemicolon (onclick); 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); #else writer.AddAttribute (HtmlTextWriterAttribute.Type, "submit"); writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID); writer.AddAttribute (HtmlTextWriterAttribute.Value, Text); if (CausesValidation && Page != null && Page.AreValidatorsUplevel ()) { string onclick = Attributes["onclick"]; if (onclick != null) { Attributes.Remove("onclick"); int len = onclick.Length; if (len > 0 && onclick[len - 1] != ';') onclick += ";"; } ClientScriptManager csm = new ClientScriptManager (Page); writer.AddAttribute (HtmlTextWriterAttribute.Onclick, onclick + csm.GetClientValidationEvent ()); writer.AddAttribute ("language", "javascript"); } #endif base.AddAttributesToRender (writer); }