"Failed to load viewstate" when clicking button

M

Marcelo

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
 
B

Brennan Stehling

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/
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top