📄 button.cs
字号:
using System;
namespace System.Web.UI.WebControls
{
/// <summary>
/// Summary description for Button.
/// </summary>
public class Button : WebControl, System.Web.UI.IPostBackEventHandler
{
private static object EventClick;
private static object EventCommand;
static Button()
{
Button.EventClick = new Object();
Button.EventCommand = new Object();
}
public Button() : base(System.Web.UI.HtmlTextWriterTag.Input)
{
}
protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer)
{
if (this.Page != null)
{
this.Page.VerifyRenderingInServerForm(this);
}
writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Type, "submit");
writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Name, this.UniqueID);
writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Value, this.Text);
// if (this.Page != null && this.CausesValidation && this.Page.Validators.Count > 0)
// {
// writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Onclick, System.Web.UI.Util.GetClientValidateEvent(this.Page));
// writer.AddAttribute("language", "javascript");
// }
base.AddAttributesToRender(writer);
}
protected virtual void OnClick(EventArgs e)
{
EventHandler local0;
local0 = (EventHandler) this.Events[Button.EventClick];
if (local0 != null)
local0.Invoke(this, e);
}
protected virtual void OnCommand(CommandEventArgs e)
{
CommandEventHandler local0;
local0 = (CommandEventHandler) this.Events[Button.EventCommand];
if (local0 != null)
local0(this, e);
this.RaiseBubbleEvent(this, e);
}
protected override void RenderContents(System.Web.UI.HtmlTextWriter writer)
{
}
void System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
{
if (this.CausesValidation)
this.Page.Validate();
this.OnClick(new EventArgs());
this.OnCommand(new CommandEventArgs(this.CommandName, this.CommandArgument));
}
public bool CausesValidation
{
get
{
object local0;
local0 = this.ViewState["CausesValidation"];
if (local0 != null)
{
return (bool) local0;
}
return true;
}
set
{
this.ViewState["CausesValidation"] = value;
}
}
public string CommandArgument
{
get
{
string local0;
local0 = (String) this.ViewState["CommandArgument"];
if (local0 != null)
return local0;
return System.String.Empty;
}
set
{
this.ViewState["CommandArgument"] = value;
}
}
public string CommandName
{
get
{
string local0;
local0 = (String) this.ViewState["CommandName"];
if (local0 != null)
return local0;
return System.String.Empty;
}
set
{
this.ViewState["CommandName"] = value;
}
}
public string Text
{
get
{
string local0;
local0 = (String) this.ViewState["Text"];
if (local0 != null)
return local0;
return System.String.Empty;
}
set
{
this.ViewState["Text"] = value;
}
}
public event System.EventHandler Click
{
add
{
base.Events.AddHandler(EventClick,value);
}
remove
{
base.Events.RemoveHandler(EventClick,value);
}
}
public event System.EventHandler Command
{
add
{
base.Events.AddHandler(EventCommand,value);
}
remove
{
base.Events.RemoveHandler(EventCommand,value);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -