"Failed to load viewstate" when clicking button

Discussion in 'ASP .Net Web Controls' started by Marcelo, Nov 6, 2006.

  1. Marcelo

    Marcelo Guest

    Hi,

    I have a problem with an ImageButton inside a web user control. It works in
    some pages, but in others, it just keeps with the "Failed to load viewstate"
    error. Basically, the controls has a textbox and the imagebutton, which on
    the click event collects the textbox content and redirects to another page.
    The controls has been inserted in all pages by dragging and dropping.

    Can somebody help me?

    TIA

    Marcelo
     
    Marcelo, Nov 6, 2006
    #1
    1. Advertising

  2. Marcelo,

    It is possible that ViewState has been disabled on some pages. Check
    the page directives at the top. Also be sure you are accessing
    ViewState only after it has been loaded.

    http://msdn2.microsoft.com/en-us/ms227435.aspx

    Also be sure you are not setting the values of the control
    programatically during a PostBack. Usually you can just set properties
    as an attribute, but if you do it with code, wrap it in an IF block.

    If ( ! IsPostBack) {
    ... set control values ...
    }

    Brennan Stehling
    http://brennan.offwhite.net/blog/

    Marcelo wrote:
    > Hi,
    >
    > I have a problem with an ImageButton inside a web user control. It works in
    > some pages, but in others, it just keeps with the "Failed to load viewstate"
    > error. Basically, the controls has a textbox and the imagebutton, which on
    > the click event collects the textbox content and redirects to another page.
    > The controls has been inserted in all pages by dragging and dropping.
    >
    > Can somebody help me?
    >
    > TIA
    >
    > Marcelo
     
    Brennan Stehling, Nov 6, 2006
    #2
    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. John Kirksey

    Failed to load ViewState

    John Kirksey, Jul 11, 2003, in forum: ASP .Net
    Replies:
    5
    Views:
    2,171
    John Kirksey
    Jul 22, 2003
  2. sck10
    Replies:
    6
    Views:
    924
    sck10
    Sep 1, 2006
  3. Andy B.
    Replies:
    0
    Views:
    889
    Andy B.
    Nov 25, 2009
  4. Josema
    Replies:
    2
    Views:
    359
  5. Josema
    Replies:
    0
    Views:
    212
    Josema
    May 9, 2005
Loading...

Share This Page