dynamic controls: viewstate & web control tree

Discussion in 'ASP .Net Web Controls' started by R Reyes, Nov 1, 2005.

  1. R Reyes

    R Reyes Guest

    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.

    Question:
    Let's say I have 1 page with a DataList for editing...it contains 2 labels
    that are set to values from the database, firstname and lastname. When a
    button is clicked we go into editmode, where we see 2 textboxes instead of
    labels. The user fills out the values and then presses enter. The error
    above pops up.

    Does this error mean that I have to create the 2 labels and 2 textboxes on
    the first page with Visible=False values for the textboxes to avoid this
    error? Since the error says the control tree must match, I'm guessing that
    the controls have to be exactly alike on both pages while we control their
    viewability with the visible=false/true property.

    Is this how it must be done? Let me know plz, thanks.
     
    R Reyes, Nov 1, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U3Vl?=

    datagrid dynamic web controls viewstate problem

    =?Utf-8?B?U3Vl?=, Dec 2, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    2,060
    =?Utf-8?B?U3Vl?=
    Dec 2, 2005
  2. Ronald
    Replies:
    2
    Views:
    867
    Robbe Morris [C# MVP]
    Jan 17, 2006
  3. Stub

    B tree, B+ tree and B* tree

    Stub, Nov 12, 2003, in forum: C Programming
    Replies:
    3
    Views:
    10,198
  4. Josema
    Replies:
    2
    Views:
    375
  5. Josema
    Replies:
    0
    Views:
    217
    Josema
    May 9, 2005
Loading...

Share This Page