Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Failed to load viewstate error

Failed to load viewstate error

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netcomsysadmintools
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Luis Alonso Ramos
    wrote on last edited by
    #1

    Hello, I have an ASP.NET form with two DIVs (both with runat=server). The first one contains all the controls, buttons and instructions. The second one only contains a success message (just text). In my Page_Load handler, I hide the second DIV, and in my OnClick handler I hide the first DIV and show the second DIV only if the operation was successful. I had implemented something like this before (not using codebehind the other time, this time I am) and it worked flawlessly. When I click on the Send button, I get an HttpException about failure to load viewstate. Any ideas? -- LuisR


    Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!

    R 1 Reply Last reply
    0
    • L Luis Alonso Ramos

      Hello, I have an ASP.NET form with two DIVs (both with runat=server). The first one contains all the controls, buttons and instructions. The second one only contains a success message (just text). In my Page_Load handler, I hide the second DIV, and in my OnClick handler I hide the first DIV and show the second DIV only if the operation was successful. I had implemented something like this before (not using codebehind the other time, this time I am) and it worked flawlessly. When I click on the Send button, I get an HttpException about failure to load viewstate. Any ideas? -- LuisR


      Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!

      R Offline
      R Offline
      Rocky Moore
      wrote on last edited by
      #2

      It may depend on where you are enabling them. I developed a library called "RJContent Panel" (posted as an article here on CP) which dynamically displays a web user control in the specified content area of a template page. I kept getting load viewstate errors if I would create the dynamic control in the page load after the Init. When I switched the process to the Init, it was all okay. I believe the postback should have the same controls available as when the page was created in order for the viewstate to load properly. Rocky <>< Opps.. Here you go!

      M 1 Reply Last reply
      0
      • R Rocky Moore

        It may depend on where you are enabling them. I developed a library called "RJContent Panel" (posted as an article here on CP) which dynamically displays a web user control in the specified content area of a template page. I kept getting load viewstate errors if I would create the dynamic control in the page load after the Init. When I switched the process to the Init, it was all okay. I believe the postback should have the same controls available as when the page was created in order for the viewstate to load properly. Rocky <>< Opps.. Here you go!

        M Offline
        M Offline
        munawarhussain
        wrote on last edited by
        #3

        hi are u using datagrid anywhere in ur project..... if it is then perhaps problem can be traced coz i been getting such prob and i did solve it.. so, plz let me know if it is.. munawar

        L 1 Reply Last reply
        0
        • M munawarhussain

          hi are u using datagrid anywhere in ur project..... if it is then perhaps problem can be traced coz i been getting such prob and i did solve it.. so, plz let me know if it is.. munawar

          L Offline
          L Offline
          Luis Alonso Ramos
          wrote on last edited by
          #4

          munawarhussain wrote: are u using datagrid anywhere in ur project No, not in this form. It's a simply contact form, with a few text boxes plus a multiline text box and a Send button. When the button is clicked, I send the message by e-mail, and if successful, I hide the DIV with the form, and make visible the DIV that contains the success message. If an error occurs, the form is kept visible and an error message is displayed. (edit) The DIV is hidden in the Page_Load handler, and it works well, the first time only the controls appear and not the success message. When I click the Send button, the exception is thrown, I believe, when I try to hide the controls' DIV, or later when the form is trying to reload the viewstate and it can't find the controls.(end edit) What is driving me nuts is that I did this exact same thing in a reusable contact form (which contains its code in the same .aspx and not in a codebehind .cs file) and it works perfectly. Thanks for your reply, -- LuisR


          Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!

          R 1 Reply Last reply
          0
          • L Luis Alonso Ramos

            munawarhussain wrote: are u using datagrid anywhere in ur project No, not in this form. It's a simply contact form, with a few text boxes plus a multiline text box and a Send button. When the button is clicked, I send the message by e-mail, and if successful, I hide the DIV with the form, and make visible the DIV that contains the success message. If an error occurs, the form is kept visible and an error message is displayed. (edit) The DIV is hidden in the Page_Load handler, and it works well, the first time only the controls appear and not the success message. When I click the Send button, the exception is thrown, I believe, when I try to hide the controls' DIV, or later when the form is trying to reload the viewstate and it can't find the controls.(end edit) What is driving me nuts is that I did this exact same thing in a reusable contact form (which contains its code in the same .aspx and not in a codebehind .cs file) and it works perfectly. Thanks for your reply, -- LuisR


            Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!

            R Offline
            R Offline
            Rocky Moore
            wrote on last edited by
            #5

            If you can post some code (simply test app) that fails, I can look at it and see what the problem is. Rocky <>< Oh ya.. Here you go![^]

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups