📄 radiobutton.cs
字号:
using System;
using System.Collections.Specialized;
using System.Globalization;
namespace System.Web.UI.WebControls
{
/// <summary>
/// Summary description for RadioButton.
/// </summary>
public class RadioButton : CheckBox,
System.Web.UI.IPostBackDataHandler
{
public RadioButton()
{
//
// TODO: Add constructor logic here
//
}
protected override void OnPreRender(EventArgs e)
{
this.OnPreRender(e);
if((this.Page != null)
&& (!(this.Checked))
&& (this.Enabled)
)
{
this.Page.RegisterRequiresPostBack(this);
}
if(this.GroupName.Length == 0)
{
this.GroupName = this.UniqueID;
}
}
protected internal virtual void RenderInputTag(System.Web.UI.HtmlTextWriter writer, string clientID)
{
string local0;
int local1;
writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Id, clientID);
writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Type, "radio");
writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Name, this.UniqueGroupName);
writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Value, this.ValueAttribute);
if (this.Checked)
writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Checked, "checked");
if (this.AutoPostBack)
{
writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Onclick, this.Page.GetPostBackClientEvent(this, ""));
writer.AddAttribute("language", "javascript");
}
local0 = this.AccessKey;
if (local0.Length > 0)
writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Accesskey, local0);
local1 = this.TabIndex;
if (local1 != 0)
writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Tabindex, local1.ToString(NumberFormatInfo.InvariantInfo));
writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Input);
writer.RenderEndTag();
}
bool System.Web.UI.IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
{
string local0;
bool local1;
local0 = postCollection[this.UniqueGroupName];
local1 = false;
if (local0 != null && local0 == this.ValueAttribute)
{
if (this.Checked)
goto i2;
this.Checked = true;
local1 = true;
}
else if (this.Checked)
this.Checked = false;
i2: return local1;
}
void System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent()
{
this.OnCheckedChanged(System.EventArgs.Empty);
}
public virtual string GroupName
{
get
{
string local0;
local0 = (String) this.ViewState["GroupName"];
if (local0 != null)
return local0;
return System.String.Empty;
}
set
{
this.ViewState["GroupName"] = value;
}
}
private string UniqueGroupName
{
get
{
string local0;
string local1;
int local2;
local0 = this.GroupName;
local1 = this.UniqueID;
local2 = local1.LastIndexOf(':');
if (local2 >= 0)
local0 = local1.Substring(0, local2 + 1) + local0;
return local0;
}
}
private string ValueAttribute
{
get
{
string local0;
local0 = this.Attributes["value"];
if (local0 == null)
{
if (this.ID != null)
local0 = this.ID;
else
local0 = this.UniqueID;
}
return local0;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -