📄 htmlinputradiobutton.cs
字号:
using System;
using System.Web.UI;
using System.Globalization;
using System.Collections.Specialized;
namespace System.Web.UI.HtmlControls
{
/// <summary>
/// Summary description for HtmlInputRadioButton.
/// </summary>
//.custom instance void [System]System.ComponentModel.DefaultEventAttribute
public class HtmlInputRadioButton : HtmlInputControl,IPostBackDataHandler
{
private static object EventServerChange;
static HtmlInputRadioButton()
{
HtmlInputRadioButton.EventServerChange = new Object();
}
public HtmlInputRadioButton() : base("radio")
{
}
protected virtual void OnPreRender(EventArgs e)
{
if (this.Page != null && !(this.Disabled))
this.Page.RegisterRequiresPostBack(this);
if (this.Events[HtmlInputRadioButton.EventServerChange]== null && !(this.Disabled))
this.ViewState.SetItemDirty("checked", false);
}
protected virtual void OnServerChange(EventArgs e)
{
EventHandler local0;
local0 = (EventHandler) this.Events[HtmlInputRadioButton.EventServerChange];
if (local0 != null)
local0.Invoke(this, e);
}
protected virtual void RenderAttributes(HtmlTextWriter writer)
{
writer.WriteAttribute("value", this.Value);
this.Attributes.Remove("value");
this.RenderAttributes(writer);
}
bool System.Web.UI.IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
{
string local0;
bool local1;
local0 = postCollection[this.RenderedNameAttribute];
local1 = false;
if (local0 != null && local0 == this.Value)
{
if (this.Checked)
goto i0;
this.Checked = true;
local1 = true;
}
else if (this.Checked)
this.Checked = false;
i0: return local1;
}
void System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent()
{
this.OnServerChange(System.EventArgs.Empty);
}
public event EventHandler ServerChange
{
add
{
this.Events.AddHandler(HtmlInputRadioButton.EventServerChange, value);
}
remove
{
this.Events.RemoveHandler(HtmlInputRadioButton.EventServerChange, value);
}
}
public bool Checked
{
get
{
string local0;
local0 = this.Attributes["checked"];
if (local0 == null)
return false;
return local0 == "checked";
}
set
{
if (value)
{
this.Attributes["checked"]= "checked";
return;
}
this.Attributes["checked"]= null;
}
}
public virtual string Name
{
get
{
string local0;
local0 = this.Attributes["name"];
if (local0 == null)
return "";
return local0;
}
set
{
this.Attributes["name"]= System.Web.UI.HtmlControls.HtmlControl.MapStringAttributeToString(value);
}
}
internal virtual string RenderedNameAttribute
{
get
{
string local0;
string local1;
int local2;
local0 = this.RenderedNameAttribute;
local1 = this.UniqueID;
local2 = local1.LastIndexOf(':');
if (local2 >= 0)
local0 = local1.Substring(0, local2 + 1) + local0;
return local0;
}
}
public virtual string Value
{
get
{
string local0;
local0 = this.Value;
if (local0.Length != 0)
return local0;
local0 = this.ID;
if (this.ID != null)
return local0;
return this.UniqueID;
}
set
{
this.Value = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -