onclick = ClientScriptManager.EnsureEndsWithSemicolon (Attributes ["onclick"] + onclick);
Attributes.Remove ("onclick");
}
- if (Page != null) {
+
+ Page page = Page;
+ if (page != null) {
PostBackOptions options = GetPostBackOptions ();
- onclick += Page.ClientScript.GetPostBackEventReference (options, true);
+ onclick += page.ClientScript.GetPostBackEventReference (options, true);
}
if (onclick.Length > 0) {
- writer.WriteAttribute ("onclick", onclick, true);
+ bool encode = true;
+ if (Events [ServerClickEvent] != null)
+ encode = false; // tests show that this is indeed
+ // the case...
+ writer.WriteAttribute ("onclick", onclick, encode);
writer.WriteAttribute ("language", "javascript");
}
}
PostBackOptions GetPostBackOptions ()
{
+ Page page = Page;
PostBackOptions options = new PostBackOptions (this);
options.ValidationGroup = null;
options.ActionUrl = null;
options.Argument = String.Empty;
options.RequiresJavaScriptProtocol = false;
options.ClientSubmit = (0 != String.Compare (Type, "submit", true, Helpers.InvariantCulture));
- options.PerformValidation = CausesValidation && Page != null && Page.Validators.Count > 0;
+ options.PerformValidation = CausesValidation && page != null && page.Validators.Count > 0;
if (options.PerformValidation)
options.ValidationGroup = ValidationGroup;