syvoon
10/25/2002 10:29:00 AM
Hi all!
I'm developing a web-based application for Pocket PC. In a form that have
datagrid( which is just a normal webform, not mobile webform). The following
errors occured.
[HttpException (0x80004005): The View State is invalid for
this page and might be corrupted.]
System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
System.Web.UI.Page.LoadPageViewState()
System.Web.UI.Page.ProcessRequestMain()
I try to solve this by overrides the above function which will store the
view state by using session variable.
protected override void SavePageStateToPersistenceMedium(object viewState)
{
Session["MyViewState"] = viewState;
}
protected override object LoadPageStateFromPersistenceMedium()
{
return Session["MyViewState"];
}
But this cause another problem, the form will always be post back.
This is my code.
private void Page_Load(object sender, System.EventArgs e)
{
if (Session["GUID"]==null)
Response.Redirect("default.aspx");
if (!Page.IsPostBack)
{
txtSrchAmtFr.Text = "0,00";
txtSrchAmtTo.Text = "9.999.999.999.999,99";
txtStartDate.Text = DateTime.Now.Date.ToString("dd/MM/yyy");
txtEndDate.Text = DateTime.Now.Date.ToString("dd/MM/yyy");
}
lblMsg.Text = "";
}
since it will always be post back, the value will always be set to initial
value.
Any solution?
Thank you in advance!