473,320 Members | 1,974 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,320 software developers and data experts.

get exceptions while using LoadViewState in ascx

hi,
Im trying to use below code in three.ascx which is pasted on two.ascx page
and two.ascx is pasted on one.aspx page. But "LoadViewState" gives
exceptions mentioned below
protected override object SaveViewState()
{ object[] SaveState;
SaveState = new object[1];
SaveState[0] = this.chkItem.Checked;
return SaveState;
}
protected override void LoadViewState(object obj)
{ object[] LoadState;
LoadState = (object[])obj;
if(LoadState != null)
{
this.chkItem.Checked = (string)LoadState[0];
}
}
GET EXCEPTIONS: 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.

how can i come out from these exceptions
Cheers,
Sam
Nov 16 '05 #1
0 1071

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

Similar topics

0
by: Christian | last post by:
Hi, I have a Webform with 1 submit button and 1 label code behind : public class MainWebForm: System.Web.UI.Page { protected System.Web.UI.WebControls.Label lblFName; protected override...
0
by: Christian | last post by:
Hi, I have a Webform with 1 submit button and 1 label code behind : public class MainWebForm: System.Web.UI.Page { protected System.Web.UI.WebControls.Label lblFName; protected override...
0
by: SSW | last post by:
Hi: In aspx.cs page i had written the code below. I only have TextBox and Button Control. LoadViewStateis Never called But when we put datagrid/DataList It works. Can any one, please tell where...
2
by: SSW | last post by:
Hi: In aspx.cs page i had written the code below. I have a button control and only create TextBox Control dynamically. LoadViewState is Never called. But when we put datagrid/DataList it...
5
by: William F. Robertson, Jr. | last post by:
I am having difficulty in diagnosing this problem and was throwing it out for some other eyes. I have derived my own Page class from System.Web.UI.Page and have overridden the LoadViewState...
0
by: Ferret | last post by:
I've found what seems to be a nasty bug in the DataGrid and Repeater classes. If CreateChildControls gets called before LoadViewState, ViewState fails to map and you end up with nothing on a...
3
by: Peter Rilling | last post by:
Okay, I am probably missing something simple so here is my problem. I have a page. On this page I have a usercontrol. On this user control I have another usercontrol. On each usercontrol I...
0
by: Vishal | last post by:
Hello, I have overrided the LoadViewState function in my webform. However when the page postsback the function is never called. Here is how I overrided it. Protected Overloads Sub...
0
by: Anand Saha | last post by:
In case you are creating your own control dynamically and need to re-create them on LoadViewState, only to discover that this function is not being called by the framework, reason and...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.