• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 229
  • Last Modified:

VIEWSTATE hidden field.

Hi All,
I have an aspx page...
It is a search form, has adropdown list asp control with other controls.
The list items are filled from a database, the number of records returned are around 50 records.
The form has a button to post the data, when i click it, it didn't work, no posting...
When i minimize the number of records returned(number of list items), the form works successfully,,,
i think the reason is in the VIEWSTATE field, i think it can contains a fixed number of characters...
If this is what cause the problem, Is there any way to enlarge its size??
If not, please help, so i can know what the problem is?

Thankx in advanced
3 Solutions
Don't use the viewstate for large amounts of information.  It does have a limit and is intended for maintaining state, not data.

Use the session object.

Everywhere you have ViewState[], replace it with Session[].

If you can't use the session object, you'll have to persist your info in other ways.  First try using the session.
are you using view state during page unload?

Do not attempt to store ViewState information in the Page.Unload event. Although no error will be thrown, the information will not be stored. This is because by the time the Page.Unload event is fired, the HTML has already been created.



samjavAuthor Commented:
i meant the "__VIEWSTATE" hidden filed generated by the page when it is called.
This field has value of long increpted string.
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Heres a work around using java:



The viewstate doesn't have a limit in size, but it does have it's drawbacks.  While it is great, realize that your users not only have to download that field, but also send it back to the server when they postback the form.  If you are storing large objects like a DataSet in it, your users are going be faced with a very slow page.  If you have large controls like a DataGrid on your page, that can fill up the viewstate quickly.
and by the way it is not encrypted, but base64 encoded
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now