Hi!
I have an application that looks something like this:
*************** *************** *************** ***************
Order.aspx
|--Thanks.ascx
|--Step.ascx
|--MultiView
|--(View1)Whois.as cx (contains EventHandler's)
|--(View2)Webbpake t.ascx
|--(View3)ContactI nfo1.ascx
|--(View3)Login.as cx (contains EventHandler's)
|--etc...
|--Start.ascx
*************** *************** *************** ***************
The "user controls" is shown/hided (visible=true/false) in the MultiView
depending on the querystring and some other info, ex: if the querystring is
"?Action=1" all UC's will be used in the Multiview but if the querystring is
"?Action=2" then all except "View2" will be used in the Multiview and it's
here where my problems start.
When "View2" is hidden my UC's containing an eventhandler will cause the
error:
**Error******** *************** *************** *************** *
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.
*************** *************** *************** ***************
I assume that it is the viewstate in Order.aspx that complains and not in
one of my UC's, but how do I solve this? Setting "EnableViewstat e=false" is
out of the question! 4 4939
As the error message says, to keep the ViewState instact you have to
recreate all user controls, even if they are not going to be visible. an****@aleborg. se wrote: Hi!
I have an application that looks something like this: *************** *************** *************** *************** Order.aspx |--Thanks.ascx |--Step.ascx |--MultiView |--(View1)Whois.as cx (contains EventHandler's) |--(View2)Webbpake t.ascx |--(View3)ContactI nfo1.ascx |--(View3)Login.as cx (contains EventHandler's) |--etc... |--Start.ascx *************** *************** *************** ***************
The "user controls" is shown/hided (visible=true/false) in the MultiView depending on the querystring and some other info, ex: if the querystring is "?Action=1" all UC's will be used in the Multiview but if the querystring is "?Action=2" then all except "View2" will be used in the Multiview and it's here where my problems start.
When "View2" is hidden my UC's containing an eventhandler will cause the error:
**Error******** *************** *************** *************** * 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. *************** *************** *************** ***************
I assume that it is the viewstate in Order.aspx that complains and not in one of my UC's, but how do I solve this? Setting "EnableViewstat e=false" is out of the question!
Hi!
Thanks, but I'm doing that, the problem occurs only when I use an
eventhandler in the usercontrol.
Regards
Anders Aleborg
Aleborg Solutions AB
"Göran Andersson" wrote: As the error message says, to keep the ViewState instact you have to recreate all user controls, even if they are not going to be visible.
an****@aleborg. se wrote: Hi!
I have an application that looks something like this: *************** *************** *************** *************** Order.aspx |--Thanks.ascx |--Step.ascx |--MultiView |--(View1)Whois.as cx (contains EventHandler's) |--(View2)Webbpake t.ascx |--(View3)ContactI nfo1.ascx |--(View3)Login.as cx (contains EventHandler's) |--etc... |--Start.ascx *************** *************** *************** ***************
The "user controls" is shown/hided (visible=true/false) in the MultiView depending on the querystring and some other info, ex: if the querystring is "?Action=1" all UC's will be used in the Multiview but if the querystring is "?Action=2" then all except "View2" will be used in the Multiview and it's here where my problems start.
When "View2" is hidden my UC's containing an eventhandler will cause the error:
**Error******** *************** *************** *************** * 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. *************** *************** *************** ***************
I assume that it is the viewstate in Order.aspx that complains and not in one of my UC's, but how do I solve this? Setting "EnableViewstat e=false" is out of the question!
I see. I assume that you recreate the user controls in the Page_Load
event? Then the problem is that the event from the user control occures
before Page_Load. You have to create the user controls in a page event
that occurs earlier, like PreInit or InitComplete. an****@aleborg. se wrote: Hi!
Thanks, but I'm doing that, the problem occurs only when I use an eventhandler in the usercontrol.
Regards Anders Aleborg Aleborg Solutions AB
"Göran Andersson" wrote:
As the error message says, to keep the ViewState instact you have to recreate all user controls, even if they are not going to be visible.
an****@aleborg. se wrote: Hi!
I have an application that looks something like this: *************** *************** *************** *************** Order.aspx |--Thanks.ascx |--Step.ascx |--MultiView |--(View1)Whois.as cx (contains EventHandler's) |--(View2)Webbpake t.ascx |--(View3)ContactI nfo1.ascx |--(View3)Login.as cx (contains EventHandler's) |--etc... |--Start.ascx *************** *************** *************** ***************
The "user controls" is shown/hided (visible=true/false) in the MultiView depending on the querystring and some other info, ex: if the querystring is "?Action=1" all UC's will be used in the Multiview but if the querystring is "?Action=2" then all except "View2" will be used in the Multiview and it's here where my problems start.
When "View2" is hidden my UC's containing an eventhandler will cause the error:
**Error******** *************** *************** *************** * 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. *************** *************** *************** ***************
I assume that it is the viewstate in Order.aspx that complains and not in one of my UC's, but how do I solve this? Setting "EnableViewstat e=false" is out of the question! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Kiyomi |
last post by:
Hello,
I create a Table1 dynamically at run time, and at the same time, I would
like to create LinkButton controls, also dynamically, and insert them into
each line in my Table1. I would then like that, when clicking the
LinkButton, the user can be navigated to another page, carrying a variable.
I would like to use server.transfer method instead of QueryString as I don't
want the carried variable to be visible for the user.
|
by: Robert |
last post by:
I need some assistance doing some "right way to do it" coding. The following
are EventHandlers associated with Delegates in a child form that call a
procedure in the MDI form that resets a timer. There must be a better way to
code this than calling OnResetTimer in all these procedures separately. Is
there not a way to use one handler for all of them?
private void pnlCPI_MouseMove(object sender,
System.Windows.Forms.MouseEventArgs e)...
|
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 the results in the grid.
Say you filter the grid for records that have a certain condition set to "NO" (in this case a checkbox). In this scenario the search returns one result. If I then check the checkbox ("YES") and save it, I now get my message...
|
by: Johan Åhlén |
last post by:
Hi,
Using a treeview with viewstate enabled easily generates very big viewstates
(hundreds of Ks). Does anyone have any experience of running treeviews
without viewstate?
To keep track of selected/clicked nodes I have added eventhandlers:
onselectedindexchange="javascript: if (this.clickedNodeIndex != null)
__saveSelectionState(this.clickedNodeIndex)"
oncheck="javascript: if (this.clickedNodeIndex != null)
|
by: Timo |
last post by:
I haven't tried coding eventhandlers in Global.asax yet -- any "gotchas" I
should be aware of? Do programming errors there require bouncing IIS? Will
handlers in Global.asax be able to access custom name/value pairs
established in web.config (e.g. <add key="foo" value="bar" /> ) using
ConfigurationSettings.AppSettings("foo") syntax?
Thanks
Timo
| |
by: Armin |
last post by:
Hello
I have a UserControl with a Click Event.
Is it possible to find out the List of all Delegates/Eventhandlers using the
Event.
I read something about a "getinvocationlist" Methode for Delegates
which can get this back, but couldN#t found out how it works.
|
by: hitendra15 |
last post by:
Hi
I have created web user control which has Repeater control and
Linkbutton in ItemTemplate of repeater control, following is the code
for this control
On first load it runs fine but when page gets post back it gives
following error
Failed to load viewstate. The control tree into which viewstate is
|
by: Kasper Birch Olsen |
last post by:
Hi NG
Im adding a bunch of linkbuttons to a page, in a for loop, but I cant get
the eventhandlers to work.
A simplyfied version of the code looks like this:
for (int i = 0; i<10; i++)
{
Button b = new Button();
|
by: Nick C |
last post by:
Hi
How can i reduce the viewstate for my asp.net application. It is getting
very large now. What is a good solution?
thanks
N
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |