Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: View State error.


Message #1 by "Nick Charlesworth" <nick@f...> on Mon, 11 Feb 2002 10:30:25
Hi,



I am working from 'Beginning ASP.NET using VB.Net' and in chapter 3 am 

getting the error:



'The View State is invalid for this page and might be corrupted.'



This error occurs on holidayresponse.aspx page when a form on 

holidaypage.aspx is submitted to holidayresponse.aspx



I have looked at the errata and added the <form runat="server"> tag but am 

still getting this viewstate error message. Does anyone know what causes 

this?



thanks,



Nick
Message #2 by "Carl E. Olsen" <carl-olsen@h...> on Mon, 11 Feb 2002 06:58:07 -0600
I had the same problem with VS.NET beta 2 running on .NET Server beta 3.

It has to do with the version of ASP.NET.  The version on .NET Server

beta 3 is older than the version in VS.NET beta 2.  You cannot use the

<form runat="server"> control, because the page needs to submit the data

to another page.



Carl



> -----Original Message-----

> From: Nick Charlesworth [mailto:nick@f...]

> Sent: Monday, February 11, 2002 10:30 AM

> To: aspx_beginners

> Subject: [aspx_beginners] View State error.

> 

> Hi,

> 

> I am working from 'Beginning ASP.NET using VB.Net' and in chapter 3 am

> getting the error:

> 

> 'The View State is invalid for this page and might be corrupted.'

> 

> This error occurs on holidayresponse.aspx page when a form on

> holidaypage.aspx is submitted to holidayresponse.aspx

> 

> I have looked at the errata and added the <form runat="server"> tag

but am

> still getting this viewstate error message. Does anyone know what

causes

> this?

> 

> thanks,

> 

> Nick



> to unsubscribe send a blank email to leave-aspx_beginners-

> 793387L@p...





Message #3 by "Nick Charlesworth" <nick@f...> on Mon, 11 Feb 2002 17:25:58
>You cannot use the

> <form runat="server"> control, because the page needs to submit the data

> to another page.

> 

> Carl



If i don't nest another form tag with runat=server within the first form 

tag I get an error message saying that the <asp:textbox /> tag can't be 

included unless <form runat="server"> has been declared before.



Nick
Message #4 by "Douglas J. Badin" <DJBadin@m...> on Mon, 11 Feb 2002 14:26:28 -0500
Well, I haven't gotten anyone to confirm it, but I don't think you can

post a Server Control to another page anymore.



Here is a link to an article that discusses Passing Server Control

Values Between Pages.



http://msdn.microsoft.com/library/en-us/cpguide/html/cpconpassingserverc

ontrolvaluesbetweenpages.asp



Here's what I did to make it work.  NOTE: Server.Transfer doesn't work

the same for .aspx as it did for .asp.



HolidayPage.aspx

--------------------------



- added the runat="server" to the form.  (Did not use 2 forms)



- added the following code:



<script runat="server" language="c#">



void Page_Load(object sender, EventArgs e)

{

            if (Page.IsPostBack) 

	{

		Server.Transfer("HolidayResponse.aspx");

            }

}

</script>





HolidayResponse.aspx

---------------------------------



void Page_Load()

{

	Page originalPage = (Page)Context.Handler ;



	TextBox FullName = (TextBox)originalPage.FindControl("FullName")

;

	Response.Write("<b>Name:</b> " + FullName.Text + "<br />");

 ....



}







Doug

 





-----Original Message-----

From: Nick Charlesworth [mailto:nick@f...] 

Sent: Monday, February 11, 2002 5:26 PM

To: aspx_beginners

Subject: [aspx_beginners] RE: View State error.





>You cannot use the

> <form runat="server"> control, because the page needs to submit the 

>data  to another page.

>

> Carl



If i don't nest another form tag with runat=server within the first form

tag I get an error message saying that the <asp:textbox /> tag can't be

included unless <form runat="server"> has been declared before.



Nick

---

Change your mail options at http://p2p.wrox.com/manager.asp or to

unsubscribe send a blank email to

$subst('Email.Unsub').

Message #5 by "Nick Charlesworth" <nick@f...> on Tue, 12 Feb 2002 09:11:19
thanks a lot guys.



Nick

  Return to Index