diff options
Diffstat (limited to 'mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs')
-rw-r--r-- | mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs | 194 |
1 files changed, 99 insertions, 95 deletions
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
+
|