Clearing ASP.NET Viewstate
Posted on 2004-09-26
I would like to know is there any way to clear out the viewstate values?
I've already tried the Me.Viewstate.Clear() method, but it seems doesn't work.
What I am trying to do is to develop a webpage, where the admins could add new users into the database.
I've coded the page so that whenever the page is postback, the validation and add user process begins.
If the data entered wasn't valid, it would return to same page with a warning message and all data in it's place (this is correct).
But now if all the data was correct and user added into database, I wanted to also return to same page with an update message, but all viewstate values cleared out, meaning that all values in controls (textbox, listbox etc) are empty.
Can someone help me please?