A
Assaf
I'm looking for the 'right way' to save the state of dynamically created
custom controls. Here's the scenario:
Multiple instances of myCustomControl are added to a page programmatically
at run time. Because they are dynamic, I have to recreate all
myCustomControl's on every postback. For now, I am saving all properties of
myCustomControl's to the ViewState in a serializable 'descriptor' class and
cycle through at page_load. That works fine but it seems like duplicate
effort because every property of every instance has to be written to the
control AND the serializable class. Also, the control is about to grow
complex soon and synchronizing it with a descriptor class will become
cumbersome.
Interested in what others have done in this situation. Has anyone attempted
implementing ISerializable on a custom control and stuffing it into a
ViewState?
Thanks for any advice.
- Assaf
custom controls. Here's the scenario:
Multiple instances of myCustomControl are added to a page programmatically
at run time. Because they are dynamic, I have to recreate all
myCustomControl's on every postback. For now, I am saving all properties of
myCustomControl's to the ViewState in a serializable 'descriptor' class and
cycle through at page_load. That works fine but it seems like duplicate
effort because every property of every instance has to be written to the
control AND the serializable class. Also, the control is about to grow
complex soon and synchronizing it with a descriptor class will become
cumbersome.
Interested in what others have done in this situation. Has anyone attempted
implementing ISerializable on a custom control and stuffing it into a
ViewState?
Thanks for any advice.
- Assaf