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. Problems with AutoPostBack=True

Problems with AutoPostBack=True

Scheduled Pinned Locked Moved ASP.NET
data-structureshelpdesigndebuggingregex
2 Posts 2 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.
  • I Offline
    I Offline
    israeli
    wrote on last edited by
    #1

    Hi ! I set several controls in my page and datagrid to have the property AutoPostBack=True. The problem is that every time I'm modifying as a user one of these controls (for instance, selecting another option from a DropDownList) the following error occur: [HttpException (0x80004005): Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.] Stack Trace: System.Web.UI.Control.LoadViewStateRecursive(Object savedState) System.Web.UI.Control.LoadViewStateRecursive(Object savedState) System.Web.UI.Control.LoadViewStateRecursive(Object savedState) System.Web.UI.Control.LoadViewStateRecursive(Object savedState) System.Web.UI.Control.LoadViewStateRecursive(Object savedState) System.Web.UI.Control.LoadViewStateRecursive(Object savedState) System.Web.UI.Control.LoadViewStateRecursive(Object savedState) System.Web.UI.Page.LoadPageViewState() System.Web.UI.Page.ProcessRequestMain() What should I do for fixing it? Thanks

    C 1 Reply Last reply
    0
    • I israeli

      Hi ! I set several controls in my page and datagrid to have the property AutoPostBack=True. The problem is that every time I'm modifying as a user one of these controls (for instance, selecting another option from a DropDownList) the following error occur: [HttpException (0x80004005): Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.] Stack Trace: System.Web.UI.Control.LoadViewStateRecursive(Object savedState) System.Web.UI.Control.LoadViewStateRecursive(Object savedState) System.Web.UI.Control.LoadViewStateRecursive(Object savedState) System.Web.UI.Control.LoadViewStateRecursive(Object savedState) System.Web.UI.Control.LoadViewStateRecursive(Object savedState) System.Web.UI.Control.LoadViewStateRecursive(Object savedState) System.Web.UI.Control.LoadViewStateRecursive(Object savedState) System.Web.UI.Page.LoadPageViewState() System.Web.UI.Page.ProcessRequestMain() What should I do for fixing it? Thanks

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Make sure if you're adding controls dynamically, that they are added before page load, and that they are always the same for the one page. Christian Graus - Microsoft MVP - C++

      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