473,403 Members | 2,183 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Failed to load viewstate (i.e., I'm doomed).

I normally try to post more helpful subject lines. But in this case, after
tons of development, my app suddenly works no more.
Here is the message: I get this on the page postback when it dynamically
builds the controls based on the value I select in a drop-down list. It is
inconsistent. Sometimes the exact same process works, and sometimes it
doesn't. BTW, my drop-down list determines the control layout.
Any help would be majorly appreciated.
message below<<


"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. "
Nov 17 '05 #1
2 2113
Jos
Mike Hnatt wrote:
I normally try to post more helpful subject lines. But in this case,
after tons of development, my app suddenly works no more.
Here is the message: I get this on the page postback when it
dynamically builds the controls based on the value I select in a
drop-down list. It is inconsistent. Sometimes the exact same
process works, and sometimes it doesn't. BTW, my drop-down list
determines the control layout.
Any help would be majorly appreciated.
message below<<


"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. "


On postback, you have to make sure that exactly the same dynamic
controls are built (same name and number) as before the postback
(preferably in Page_Load), EVEN IF YOU DON'T WANT THEM TO
APPEAR ON YOUR PAGE ANYMORE.

Only then the necessary control postback events can fire.

In the handlers for these events, you can then rebuild your page
by destroying any unwanted controls and by adding new ones.

--

Jos
Nov 17 '05 #2
Thanks Jos,
I will try that. I just can't seem to understand why it worked fine for
hundreds of times until now. I'm sure it is something though. Thanks for
the help!
Mike

"Jos" <jo***************@fastmail.fm> wrote in message
news:ug**************@tk2msftngp13.phx.gbl...
Mike Hnatt wrote:
I normally try to post more helpful subject lines. But in this case,
after tons of development, my app suddenly works no more.
Here is the message: I get this on the page postback when it
dynamically builds the controls based on the value I select in a
drop-down list. It is inconsistent. Sometimes the exact same
process works, and sometimes it doesn't. BTW, my drop-down list
determines the control layout.
Any help would be majorly appreciated.
message below<<


"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. "


On postback, you have to make sure that exactly the same dynamic
controls are built (same name and number) as before the postback
(preferably in Page_Load), EVEN IF YOU DON'T WANT THEM TO
APPEAR ON YOUR PAGE ANYMORE.

Only then the necessary control postback events can fire.

In the handlers for these events, you can then rebuild your page
by destroying any unwanted controls and by adding new ones.

--

Jos

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Eamonn O'Connell | last post by:
Hi, We have an ASP.net application, where we dynamically add controls, in the Page_Load. Occasionally, when the user posts back the page (e.g. clicks Save button on the page), we get a "Failed...
0
by: Josema | last post by:
Hi to all, I have a webform.aspx and inside i have a dropdown list with autopostback and a place holder... Depending of the selected index that the user selects in the dropdownlist i load a...
9
by: John Kirksey | last post by:
I have a page that uses an in-place editable DataGrid that supports sorting and paging. EnableViewState is turned ON. At the top of the page are several search fields that allow the user to filter...
1
by: et | last post by:
I. 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...
1
by: rockdale | last post by:
Sometime my ASP.NET application got this error message but not always everytime. Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that...
6
by: sck10 | last post by:
Hello, I have applications that produce the following error when they have been open to long without activity. Is there any way to force a re-load of the page or go to another page if the page...
2
by: sck10 | last post by:
Hello, I have a web page that has a GridView and a FormView, each in its own panel. The GridView shows a list of records in a database. When a row in the GridView is selected the FormView...
0
by: nithagowda | last post by:
Hello, I have a DropDownList for source type and a panel for displaying TreeView based on the source type.. The problem is- if i select different source type drom ddlSrcType, other than the...
2
by: Rotsey | last post by:
Hi, I have a web site that uses user controls to display different formats of timesheets. I have a browse page that has prev/next buttons to browse through a set of timesheets. As I say...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.