views:

90

answers:

1

Hi

I have an IScriptControl that needs to persist data from the user across postbacks. Currently I'm writing the data to a hidden field, but I'd like to switch to ControlState.

So my question is: Is it possible to update ControlState data from client script?

Thanks,

Aleko

A: 

Not really. Control state is a hierarchy of object arrays serialized to a binary string and validated with a hashsum. It can also be outright encrypted. I'm sure someone could point to an example where someone managed to manipulate that blob of data through JavaScript, but I'd recommend that as soon as I'd recommend figuring out a way to flip bits on your hard disk to get what you want instead of going through your operating system API.

However, you can use something like the UpdatePanel to make asynchronous (AJAX) postbacks behind the scenes, and the UpdatePanel will handle fixing the control state each time.

Rex M
Yeah, I suspected as much, but I was *hoping* there was some AJAX API that lets you modify ViewState/ControlState. Oh well, back to the hidden field.Thanks, Rex M.
alekop