⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 linkbutton.cs

📁 不错的人事管理系统
💻 CS
字号:
using System;

namespace System.Web.UI.WebControls
{
	/// <summary>
	/// Summary description for LinkButton.
	/// </summary>
	public class LinkButton : System.Web.UI.WebControls.WebControl, System.Web.UI.IPostBackEventHandler
	{
		private static object EventClick;
		private static object EventCommand;

		static LinkButton()
		{
			EventClick = new object();
			EventCommand = new object();
		}

		public LinkButton() : base(System.Web.UI.HtmlTextWriterTag.A)
		{
		}

		protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer)
		{
			if(this.Page != null)
			{
				this.Page.VerifyRenderingInServerForm(this);
			}
			base.AddAttributesToRender(writer);

			if(this.Enabled)
			{
				if(this.Page != null)
				{
					if(this.CausesValidation)
					{
//						if(this.Page.Validators.Count >0)
//						{
//							writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Href,string.Concat("javascript:",System.Web.UI.Util.GetClientValidatedPostback(this)));
//						}
//						else
//						{
//							writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Href, this.Page.GetPostBackClientHyperlink(this,""));
//						}
					}
				}
			}
		}

		protected override void AddParsedSubObject(object obj)
		{
			string V_0;
			if(this.HasControls())
			{
				base.AddParsedSubObject(obj);
			}
			else if(obj is System.Web.UI.LiteralControl)
			{
				this.Text = ((System.Web.UI.LiteralControl)obj).Text;
			}
			else
			{
				V_0 = this.Text;
				if(V_0.Length!= 0)
				{
					this.Text = string.Empty;
					base.AddParsedSubObject(new System.Web.UI.LiteralControl(V_0));
					//是否漏了return??
				}

				base.AddParsedSubObject(obj);
			}
		}

		protected override void LoadViewState(object savedState)
		{
			string V_0;
			if(savedState != null)
			{
				base.LoadViewState(savedState);
				V_0 = (string)base.ViewState["Text"];
				if(V_0 != null)
				{
					this.Text = V_0;
				}
			}
		}

		protected virtual void OnClick(System.EventArgs e)
		{
			System.EventHandler V_0;
			V_0 = (System.EventHandler)base.Events[EventClick];

			if(V_0 != null)
			{
				V_0(this,e);
			}
		}

		protected virtual void OnCommand(System.Web.UI.WebControls.CommandEventArgs e)
		{
			System.Web.UI.WebControls.CommandEventHandler V_0;
			V_0 = (System.Web.UI.WebControls.CommandEventHandler)base.Events[EventCommand];

			if(V_0 != null)
			{
				V_0(this,e);
			}

			this.RaiseBubbleEvent(this,e);
		}

		protected override void OnPreRender(System.EventArgs e)
		{
			base.OnPreRender(e);
			if(this.Page != null)
			{
				if(this.Enabled)
				{
					this.Page.RegisterPostBackScript();
				}
			}
		}

		protected override void RenderContents(System.Web.UI.HtmlTextWriter writer)
		{
			if(this.HasControls())
			{
				base.RenderContents(writer);
			}
			else
			{
				writer.Write(this.Text);
			}
		}

		public bool CausesValidation
		{
			get
			{
				object V_0;
				V_0 = this.ViewState["CausesValidation"];
				if(V_0 != null)
				{
					return (bool)V_0;
				}
				return(true);
			}
			set
			{
				this.ViewState["CausesValidation"]= value;
			}
		}

		/// <summary>
		/// 
		/// </summary>
		public virtual string Text
		{
			get
			{
				object V_0;
				V_0 = this.ViewState["Text"];
				if(V_0 != null)
				{
					return(string)V_0;
				}
				return(string.Empty);
			}
			set
			{
				if(this.HasControls())
				{
					this.Controls.Clear();
				}
				this.ViewState["Text"] = value;
			}
		}

		void  System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
		{
			if(this.CausesValidation)
			{
				this.Page.Validate();
			}
			this.OnClick(new System.EventArgs());
			this.OnCommand(new System.Web.UI.WebControls.CommandEventArgs(this.CommandName, this.CommandArgument));
		}

		public string CommandArgument
		{
			get
			{
				string V_0;
				V_0 = (string)this.ViewState["CommandArgument"];
				if(V_0 != null)
				{
					return(V_0);
				}
				return(string.Empty);
			}
			set
			{
				this.ViewState["CommandArgument"]= value;
			}
		}

		public string CommandName
		{
			get
			{
				string V_0;
				V_0 = (string)this.ViewState["CommandName"];
				if(V_0 != null)
				{
					return(V_0);
				}
				return(string.Empty);
			}
			set
			{
				this.ViewState["CommandName"]= value;
			}
		}

		public event System.EventHandler Click
		{
			add
			{
				base.Events.AddHandler(EventClick,value);
			}
			remove
			{
				base.Events.RemoveHandler(EventClick,value);
			}
		}

		public event System.Web.UI.WebControls.CommandEventHandler Command
		{
			add
			{
				base.Events.AddHandler(EventCommand,value);
			}
			remove
			{
				base.Events.RemoveHandler(EventCommand,value);
			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -