mko
mko

Reputation: 7335

Updating ViewState using jQuery

I started to use jQuery more intensively and especially .ajax() in jQuery. I would like to know if it is a good idea to manipulate ViewState using .ajax() or if there is a better way to manipulate ViewState without a full postback.

Upvotes: 0

Views: 1558

Answers (2)

Rune
Rune

Reputation: 8380

Unless you have a very specific reason and know what you are doing, this sounds like an approach that will lead you into a lot of pain. ViewState isn't meant to be modified by the client.

Why would you want to do this? I would guess that there is an easier and more maintainable way of achieving what you are trying to achieve.

Upvotes: 1

Andy Rose
Andy Rose

Reputation: 17014

I would say no. Apart from the fact that you will be having to deal with an encoded string, any error would result in a full page post back failing.

If you need to pass data that was the result of ajax queries back to the server during a postback I would suggest storing it in a hidden field or fields and retrieving them from the form collection on the server.

Upvotes: 1

Related Questions