Custom Controls, Public properties and the Viewstate

Discussion in 'ASP .Net' started by trullock, Feb 19, 2008.

  1. trullock

    trullock Guest

    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
     
    trullock, Feb 19, 2008
    #1
    1. Advertisements

  2. trullock

    bruce barker Guest

    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)
     
    bruce barker, Feb 19, 2008
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.