asp.net – Update ControlState from client script? – Education Career Blog

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

,

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.

Leave a Comment