62,046
社区成员
发帖
与我相关
我的任务
分享
<body>
<form id="form1" runat="server">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" />
</form>
</body>
protected void Page_Load(object sender, EventArgs e)
{
}
protected override void LoadViewState(object savedState)
{
Response.Write(" this is LoadViewState event!");
base.LoadViewState(savedState);
}
protected override object SaveViewState()
{
Response.Write(" this is SaveViewState event!");
return base.SaveViewState();
}
internal void LoadViewStateRecursive(object savedState)
{
if ((savedState != null) && !this.flags[4])
{
if ((this.Page != null) && this.Page.IsPostBack)
{
object first = null;
object state = null;
ArrayList childState = null;
Pair pair = savedState as Pair;
if (pair != null)
{
first = pair.First;
childState = (ArrayList) pair.Second;
}
else
{
Triplet triplet = (Triplet) savedState;
first = triplet.First;
state = triplet.Second;
childState = (ArrayList) triplet.Third;
}
try
{
if ((state != null) && (this._adapter != null))
{
this._adapter.LoadAdapterViewState(state);
}
if (first != null)
{
this.LoadViewState(first);
}
if (childState != null)
{
if (this.LoadViewStateByID)
{
this.LoadChildViewStateByID(childState);
}
else
{
this.LoadChildViewStateByIndex(childState);
}
}
}
catch (InvalidCastException)
{
throw new HttpException(SR.GetString("Controls_Cant_Change_Between_Posts"));
}
catch (IndexOutOfRangeException)
{
throw new HttpException(SR.GetString("Controls_Cant_Change_Between_Posts"));
}
}
this._controlState = ControlState.ViewStateLoaded;
}
}
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server" Text="123"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" />
</div>
</form>
</body>
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected override void LoadViewState(object savedState)
{
base.LoadViewState(savedState);
}
public virtual bool LoadPostData(string postDataKey, NameValueCollection postCollection)
{
return true;
}
}