From b259284dc22e8630c7efbfc4a8ce7c526b609d41 Mon Sep 17 00:00:00 2001 From: Gaurav Vaish Date: Thu, 24 Jan 2002 04:14:05 +0000 Subject: 2002-24-02 Gaurav Vaish * *.cs -- Updates from Leen Toelen (toelen@hotmail.com) svn path=/trunk/mcs/; revision=2142 --- .../System.Web.UI.HtmlControls/HtmlAnchor.cs | 194 +++++++++++---------- 1 file changed, 99 insertions(+), 95 deletions(-) (limited to 'mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs') diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs index bd319d61b54..8d8a4787198 100644 --- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs +++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs @@ -1,95 +1,99 @@ -/* System.Web.UI.HtmlControls -* Authors -* Leen Toelen (toelen@hotmail.com) -*/ - -using System; -using System.Web; -using System.Web.UI; - -namespace System.Web.UI.HtmlControls{ - - public class HtmlAnchor : HtmlContainerControl, IPostBackEventHandler{ - - private static readonly object EventServerClick; - - public HtmlAnchor(): base("a"){} - - protected virtual void OnServerClick(EventArgs e){ - EventHandler handler; - handler = (EventHandler) Events[EventServerClick]; - if(handler != null) handler.Invoke(this, e); - } - - protected new void RenderAttributes(HtmlTextWriter writer){ - if ( (EventHandler) Events[EventServerClick] != null){ - Attributes.Remove("href"); - RenderAttributes(writer); - writer.WriteAttribute(Page.GetPostBackClientHyperlink(this,""),"href"); - } - else{ - PreProcessRelativeReference(writer,"href"); - RenderAttributes(writer); - } - } - - public void RaisePostBackEvent(string eventArgument){ - OnServerClick(EventArgs.Empty); - } - - public event EventHandler ServerClick{ - add{ - Events.AddHandler(EventServerClick, value); - } - remove{ - Events.RemoveHandler(EventServerClick, value); - } - } - - public string HRef{ - get{ - string attr = Attributes["href"]; - if (attr != null) return attr; - return ""; - } - set{ - Attributes["href"] = AttributeToString(value); - } - } - - public string Name{ - get{ - string attr = Attributes["name"]; - if (attr != null) return attr; - return ""; - } - set{ - Attributes["name"] = AttributeToString(value); - } - } - - public string Target{ - get{ - string attr = Attributes["target"]; - if (attr != null) return attr; - return ""; - } - set{ - Attributes["target"] = AttributeToString(value); - } - } - - public string Title{ - get{ - string attr = Attributes["title"]; - if (attr != null) return attr; - return ""; - } - set{ - Attributes["title"] = AttributeToString(value); - } - } - - } // class HtmlAnchor -} // namespace System.Web.UI.HtmlControls - +/* System.Web.UI.HtmlControls +* Authors +* Leen Toelen (toelen@hotmail.com) +*/ + +using System; +using System.Web; +using System.Web.UI; + +namespace System.Web.UI.HtmlControls{ + + public class HtmlAnchor : HtmlContainerControl, IPostBackEventHandler{ + + private static readonly object EventServerClick; + + static HtmlAnchor(){ + EventServerClick = new Object(); + } + + public HtmlAnchor(): base("a"){} + + protected virtual void OnServerClick(EventArgs e){ + EventHandler handler; + handler = (EventHandler) Events[EventServerClick]; + if(handler != null) handler.Invoke(this, e); + } + + protected new void RenderAttributes(HtmlTextWriter writer){ + if ( Events[EventServerClick] != null){ + Attributes.Remove("href"); + base.RenderAttributes(writer); + writer.WriteAttribute("href", Page.GetPostBackClientHyperlink(this,String.Empty)); + } + else{ + PreProcessRelativeReference(writer,"href"); + RenderAttributes(writer); + } + } + + void System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(string eventArgument){ + OnServerClick(EventArgs.Empty); + } + + public event EventHandler ServerClick{ + add{ + Events.AddHandler(EventServerClick, value); + } + remove{ + Events.RemoveHandler(EventServerClick, value); + } + } + + public string HRef{ + get{ + string attr = Attributes["href"]; + if (attr != null) return attr; + return String.Empty; + } + set{ + Attributes["href"] = AttributeToString(value); + } + } + + public string Name{ + get{ + string attr = Attributes["name"]; + if (attr != null) return attr; + return String.Empty; + } + set{ + Attributes["name"] = AttributeToString(value); + } + } + + public string Target{ + get{ + string attr = Attributes["target"]; + if (attr != null) return attr; + return String.Empty; + } + set{ + Attributes["target"] = AttributeToString(value); + } + } + + public string Title{ + get{ + string attr = Attributes["title"]; + if (attr != null) return attr; + return String.Empty; + } + set{ + Attributes["title"] = AttributeToString(value); + } + } + + } // class HtmlAnchor +} // namespace System.Web.UI.HtmlControls + -- cgit v1.2.3