|
using System;
using System.Reflection;
using System.Web.UI;
public partial class AccessViewState : System.Web.UI.Page
{
private StateBag PreviousPageViewState
{
get
{
StateBag returnValue = null;
if (PreviousPage != null)
{
Object objPreviousPage = (Object)PreviousPage;
MethodInfo objMethod = objPreviousPage.GetType().GetMethod("ReturnViewState");
return (StateBag)objMethod.Invoke(objPreviousPage, null);
//foreach (MethodInfo objMethodInfo in obj.GetType().GetMethods())
//{
// if (objMethodInfo.Name == "ReturnViewState")
// {
// return (StateBag)objMethodInfo.Invoke(obj, null);
// }
//}
}
return returnValue;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (PreviousPage != null)
{
if (PreviousPageViewState != null)
{
Label1.Text = PreviousPageViewState["Page1"].ToString();
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.