[CLOSED] Failed to load viewstate

  1. #1

    [CLOSED] Failed to load viewstate

    I get this error when I select item from the dropdown. I breaks before to go to the code behind

    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.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    
    Exception Details: System.Web.HttpException: 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.
    
    Source Error:
    
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
    
    Stack Trace:
    
    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.]
       System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +303
       System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134
       System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +218
       System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134
       System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +218
       System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134
       System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +218
       System.Web.UI.Page.LoadAllState() +312
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1661
    <ext:Store ID="findJobs" runat="server">
    
    <Proxy>
    
    <ext:HttpProxy Method="POST" Url="~/FindJobs.ashx" />
    
    </Proxy>
    
    <Reader>
    
    <ext:JsonReader Root="Jobs" TotalProperty="totalCount">
    
    <Fields>
    
    <ext:RecordField Name="JobID" />
    
    <ext:RecordField Name="SapJobID" />
    
    <ext:RecordField Name="JobTitle" />
    
    <ext:RecordField Name="Band" />
    
    <ext:RecordField Name="IsActive" />
    
    </Fields>
    
    </ext:JsonReader>
    
    </Reader>
    
    </ext:Store>
    
    <div >
    
    <div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc">
    
    
    
    
    <div class="x-box-ml"><div class="x-box-mr"><div class="x-box-mc">
    
    <ext:ComboBox ID="cmbFindJobs" runat="server" AllowBlank="false"
    
    TypeAhead="false" EmptyText="Type job title or job id...."
    
    StoreID="findJobs"
    
    DisplayField="JobTitle"
    
    ValueField="JobID"
    
    LoadingText="Searching....."
    
    Width="650" PageSize="10" HideTrigger="true" ItemSelector="div.search-item" MinChars="3"
    
    >
    
    <DirectEvents>
    
    <Select OnEvent="GetJobdetails">
    
    <EventMask ShowMask="true" />
    
    </Select>
    
    </DirectEvents>
    
    <Template ID="Template1" runat="server">
    
    <Html>
    
    <tpl for=".">
    
    <div class="search-item">
    
    <h3>{IsActive} {Band}{SapJobID} {JobTitle}</h3>
    
    
    
    
    </tpl>
    
    </Html>
    
    </Template>
    
    </ext:ComboBox>
    
    
    
    
    
    
    
    
    <div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc">
  2. #2

    RE: [CLOSED] Failed to load viewstate

    Hi,

    The information is not enough. I believe that you have dynamic controls which you doesn't recreate during DirectEvent (or create another instead controls which were created initialy)


    Please post full test sample
  3. #3

    RE: [CLOSED] Failed to load viewstate

    Yes, I have the search into user control. which method should I use
  4. #4

    RE: [CLOSED] Failed to load viewstate

    Thanks Vlad,

    I used DiredtMethod

    <Listeners>
        <Select Handler="#{DirectMethods}.GetJobdetails();" />
    </Listeners>
  5. #5

    RE: [CLOSED] Failed to load viewstate

    I was trying to create delegate event. It always comes as null. do you have an idea

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="getnametest.ascx.cs" Inherits="test.scripts.getnametest" %>
    
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
    
    <script runat="server">
    
    public delegate void ItemSelectedEventHandler(string id);
    
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!X.IsAjaxRequest)
        {
            this.Button1.Text = string.Concat("UserControl (", this.Name, ")");
        }
    }
    
    public event ItemSelectedEventHandler test25;
    
    [DirectMethod]
    public void GetName()
    {
        if (test25 != null)
        {
            X.Msg.Alert("Name", this.Name).Show();
        }
    }
    
    public string Name
    {
        get;
        set;
    }
    </script>
    <ext:Button ID="Button1" runat="server" Text="test">
        <Listeners>
        <   Click Handler="#{DirectMethods}.GetName();" />
        </Listeners>
    </ext:Button>
  6. #6

    RE: [CLOSED] Failed to load viewstate

    Hi sharif,

    Please do not include the .dlls in any attachments.


    As well, adding [CODE] tags around your code samples will help with formatting.


    Geoffrey McGill
    Founder
  7. #7

    RE: [CLOSED] Failed to load viewstate

    Thank you guys. I got it work. you close this item
    sorry about the dll too

    I had this line of code in my master page. I used it for javascript reference




    //Page.Header.DataBind();

Similar Threads

  1. [CLOSED] Validation of viewstate MAC failed
    By gidi in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Mar 01, 2012, 10:15 PM
  2. Replies: 2
    Last Post: Jan 23, 2012, 6:57 PM
  3. Failed to load resource
    By tuananhdnx in forum 1.x Help
    Replies: 3
    Last Post: Dec 27, 2011, 1:26 PM
  4. Validation of viewstate MAC failed... Help!
    By Tbaseflug in forum 1.x Help
    Replies: 1
    Last Post: Nov 04, 2010, 1:20 PM
  5. One to many - Load Failed OK
    By filipator in forum 1.x Help
    Replies: 2
    Last Post: Mar 23, 2009, 2:43 PM

Posting Permissions