Custom Controls, Public properties and the Viewstate

T

trullock

Hi,

I've written a custom control which needs to have several public
properties.

Do i have to write a viewstate getter and setter for every property,
or is there some decoration (or other method) i can apply to make
their values be persisted across postbacks?

Thanks

Andrew
 
B

bruce barker

you need to write a getter/setter for each property. most controls public
properties are just viewstate getter/setters. you can use the
LoadControlState and SaveControlState methods to get/set one serializable
object instead.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top