if (Page != null)
Page.VerifyRenderingInServerForm (this);
+#if NET_2_0
+ string onclick = OnClientClick;
+ onclick = ClientScriptManager.EnsureEndsWithSemicolon (onclick);
+ if (Attributes ["onclick"] != null) {
+ onclick = ClientScriptManager.EnsureEndsWithSemicolon (onclick + Attributes ["onclick"]);
+ Attributes.Remove ("onclick");
+ }
+
+ if (onclick.Length > 0)
+ w.AddAttribute (HtmlTextWriterAttribute.Onclick, onclick);
+
+ if (Enabled && Page != null) {
+ PostBackOptions options = GetPostBackOptions ();
+ string href = Page.ClientScript.GetPostBackEventReference (options);
+ w.AddAttribute (HtmlTextWriterAttribute.Href, href);
+ }
+ base.AddAttributesToRender (w);
+#else
base.AddAttributesToRender (w);
if (Page == null || !Enabled)
return;
} else {
w.AddAttribute (HtmlTextWriterAttribute.Href, Page.ClientScript.GetPostBackClientHyperlink (this, ""));
}
+#endif
}
#if NET_2_0
- [MonoTODO]
- protected virtual void RaisePostBackEvent (string eventArgument)
- {
- throw new NotImplementedException ();
- }
+ protected virtual
#endif
-
- void IPostBackEventHandler.RaisePostBackEvent (string ea)
+ void RaisePostBackEvent (string eventArgument)
{
if (CausesValidation)
#if NET_2_0
OnClick (EventArgs.Empty);
OnCommand (new CommandEventArgs (CommandName, CommandArgument));
}
+
+ void IPostBackEventHandler.RaisePostBackEvent (string ea)
+ {
+ RaisePostBackEvent (ea);
+ }
protected override void AddParsedSubObject (object obj)
{
#if NET_2_0
protected virtual PostBackOptions GetPostBackOptions ()
{
- return new PostBackOptions(this, PostBackUrl, null, false, true,
- false, true, CausesValidation,
- ValidationGroup);
+ PostBackOptions options = new PostBackOptions (this);
+ options.ActionUrl = (PostBackUrl.Length > 0 ? Page.ResolveClientUrl (PostBackUrl) : null);
+ options.ValidationGroup = null;
+ options.Argument = "";
+ options.ClientSubmit = true;
+ options.RequiresJavaScriptProtocol = true;
+ options.PerformValidation = CausesValidation && Page != null && Page.AreValidatorsUplevel (ValidationGroup);
+ if (options.PerformValidation)
+ options.ValidationGroup = ValidationGroup;
+
+ return options;
}
#endif
#if NET_2_0
[DefaultValue ("")]
[Themeable (false)]
- [MonoTODO]
[WebSysDescription ("")]
[WebCategoryAttribute ("Behavior")]
public virtual string OnClientClick
{
get {
- throw new NotImplementedException ();
+ return ViewState.GetString ("OnClientClick", "");
}
set {
- throw new NotImplementedException ();
+ ViewState ["OnClientClick"] = value;
}
}