corrupt viewstate on form.submit

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tony Hedge

    #1

    corrupt viewstate on form.submit

    Hello,

    I hope some one can answer this for me.

    I am using .NET version 1.0 on Windows 2000Pro and I am
    getting an error when doing a form submit from an HTML
    control. Please look at the following brief code example:

    I have two aspx file WebForm1.aspx and WebForm2.aspx.
    WebForm1 has the following elements:
    ....
    <form id="Form1" method="post" action="" runat="server">
    <input id="h1" name="h1" value="1" type="hidden">
    <input type="button" id="btnGo" name="btnGo" value="GO"
    onclick="CallGo ()">
    </form>
    ....

    This is the code for function CallGo:
    <script language="javas cript">
    function CallGo()
    {
    document.forms( 'Form1').action = 'WebForm2.aspx' ;
    document.forms( 'Form1').submit ();
    }
    </script>

    I added no code to the code-behind page for WebForm1.

    When I click on button GO, the client side CallGo function
    exectues but I get the following error at the submit point:
    'The View State is invalid for this page and might be
    corrupted.'

    However, if I take out the runat=server attribute from the
    form element above, everything works as expected.

    I need to use the runat=server attribute on the form
    element because I will be adding code in the code-behind
    page for it. Can anyone explain how to get around this
    error?

    Much appreciated!
    Tony
  • Tim Stephenson

    #2
    Re: corrupt viewstate on form.submit

    It's a long shot, but see if your page has "viewstateM ac" enabled. Turning
    this off might help solve the problem.
    If not, do you have problems running "normal" pages generated by Visual
    Studio (for example) ?

    --

    Regards

    Tim Stephenson MCSD.NET
    Charted MCAD & MCSD.NET Early Achiever




    "Tony Hedge" <bensonandhedge s@yahoo.com> wrote in message
    news:084d01c38e af$0a6ea430$a10 1280a@phx.gbl.. .[color=blue]
    > Hello,
    >
    > I hope some one can answer this for me.
    >
    > I am using .NET version 1.0 on Windows 2000Pro and I am
    > getting an error when doing a form submit from an HTML
    > control. Please look at the following brief code example:
    >
    > I have two aspx file WebForm1.aspx and WebForm2.aspx.
    > WebForm1 has the following elements:
    > ...
    > <form id="Form1" method="post" action="" runat="server">
    > <input id="h1" name="h1" value="1" type="hidden">
    > <input type="button" id="btnGo" name="btnGo" value="GO"
    > onclick="CallGo ()">
    > </form>
    > ...
    >
    > This is the code for function CallGo:
    > <script language="javas cript">
    > function CallGo()
    > {
    > document.forms( 'Form1').action = 'WebForm2.aspx' ;
    > document.forms( 'Form1').submit ();
    > }
    > </script>
    >
    > I added no code to the code-behind page for WebForm1.
    >
    > When I click on button GO, the client side CallGo function
    > exectues but I get the following error at the submit point:
    > 'The View State is invalid for this page and might be
    > corrupted.'
    >
    > However, if I take out the runat=server attribute from the
    > form element above, everything works as expected.
    >
    > I need to use the runat=server attribute on the form
    > element because I will be adding code in the code-behind
    > page for it. Can anyone explain how to get around this
    > error?
    >
    > Much appreciated!
    > Tony[/color]


    Comment

    Working...