📄 htmlform.cs
字号:
using System;
namespace System.Web.UI.HtmlControls
{
/// <summary>
/// Summary description for HtmlForm.
/// </summary>
public class HtmlForm : HtmlContainerControl
{
private const string SmartNavIncludeScriptKey = "SmartNavIncludeScript";
public HtmlForm() : base("form")
{
}
private string GetActionAttribute()
{
string local0;
string local1;
string local2;
int local3;
string local4;
local0 = this.Context.Request.CurrentExecutionFilePath;
local1 = this.Context.Request.FilePath;
if (System.Object.ReferenceEquals(local0, local1))
{
local2 = local1;
local3 = local2.LastIndexOf('/');
if (local3 < 0)
goto i0;
local2 = local2.Substring(local3 + 1);
}
else
local2 = System.Web.Util.UrlPath.MakeRelative(local1, local0);
i0: local4 = this.Context.Request.QueryStringText;
if (local4 != null && local4.Length != 0)
local2 = local2 + "?" + local4;
return local2;
}
protected virtual void OnInit(EventArgs e)
{
this.OnInit(e);
this.Page.RegisterViewStateHandler();
}
protected virtual void Render(HtmlTextWriter output)
{
Page local0;
local0 = this.Page;
if (local0 == null)
throw new HttpException(System.Web.HttpRuntime.FormatResourceString("Form_Needs_Page"));
if (local0.SmartNavigation)
{
// this.SetAttribute("__smartNavEnabled", "true");
output.WriteLine("<IFRAME ID=__hifSmartNav NAME=__hifSmartNav STYLE=display:none src=\"javascript:smartnav=1\"></IFRAME>");
if (local0.SmartNavigationIE50)
local0.RegisterClientScriptFileInternal("SmartNavIncludeScript", "JScript", "SmartNavIE5.js");
else if (!(local0.IsPostBack))
local0.RegisterClientScriptFileInternal("SmartNavIncludeScript", "JScript", "SmartNav.js");
}
this.Render(output);
}
protected virtual void RenderAttributes(HtmlTextWriter writer)
{
string local0;
writer.WriteAttribute("name", this.Name);
this.Attributes.Remove("name");
writer.WriteAttribute("method", this.Method);
this.Attributes.Remove("method");
writer.WriteAttribute("action", this.GetActionAttribute(), true);
this.Attributes.Remove("action");
local0 = this.Page.ClientOnSubmitEvent;
if (local0 != null && local0.Length > 0)
{
if (this.Attributes["onsubmit"] != null)
{
local0 = local0 + this.Attributes["onsubmit"];
this.Attributes.Remove("onsubmit");
}
writer.WriteAttribute("language", "javascript");
writer.WriteAttribute("onsubmit", local0);
}
if (this.ID == null)
writer.WriteAttribute("id", this.ClientID);
this.RenderAttributes(writer);
}
protected virtual void RenderChildren(HtmlTextWriter writer)
{
this.Page.OnFormRender(writer, this.ClientID);
this.RenderChildren(writer);
this.Page.OnFormPostRender(writer, this.ClientID);
}
public string Enctype
{
get
{
string local0;
local0 = this.Attributes["enctype"];
if (local0 == null)
return "";
return local0;
}
set
{
this.Attributes["enctype"]= System.Web.UI.HtmlControls.HtmlControl.MapStringAttributeToString(value);
}
}
public string Method
{
get
{
string local0;
local0 = this.Attributes["method"];
if (local0 == null)
return "post";
return local0;
}
set
{
this.Attributes["method"]= System.Web.UI.HtmlControls.HtmlControl.MapStringAttributeToString(value);
}
}
public virtual string Name
{
get
{
return this.UniqueID;
}
set
{
throw new Exception("");
}
}
public string Target
{
get
{
string local0;
local0 = this.Attributes["target"];
if (local0 == null)
return "";
return local0;
}
set
{
this.Attributes["target"]= System.Web.UI.HtmlControls.HtmlControl.MapStringAttributeToString(value);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -