ViewState Collection gets cleared?

R

raffe

Hi all!

I have a control which represents a user record in my database and a save
button. It get's loaded into a placeholder and all the controls like TextBox
get bound to the data source. At the same time I put record id in the
ViewState collection. When the save button click event gets fired the
ViewState collection is empty.

How can that happen? All the TextBoxes on the control still have their
values. I have read that all controls need to have a unique id when placed
in placeholder. Well, they have.
Any ideas?

Rafael
 
R

raffe

Fixed that. Argh! The event model in ASP.NET drives me nutts! The clue here
was to add the variable to the ViewState collection BEFORE page load.

Rafael
 
W

William F. Robertson, Jr.

That doesn't sound right, you can add items to the viewstate up until the
prerender event (calls SaveViewState). How/where/when/what are you placing
into ViewState?

bill
 

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

Top