help for properties persistence

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default help for properties persistence

    Hi. I'm developing a WebControl that uses the following custom attributes:

    [ParseChildren(false), PersistChildren(false)]

    I'm using ParseChildren(false), because i've got two collection properties
    that use the following custom attributes:

    [NotifyParentProperty(true),
    PersistenceMode(PersistenceMode.InnerProperty),
    DesignerSerializationVisibility(DesignerSerializat ionVisibility.Content)]

    The ASPX code produced by VS.NET is something like:

    <cc:myControl>
    <collection1>
    <cc:innerControl id="innerControl11"/>
    <cc:innerControl id="innerControl12"/>
    </collection1>
    <collection2>
    <cc:innerControl id="innerControl21"/>
    <cc:innerControl id="innerControl22"/>
    </collection1>
    </cc:myControl>

    The problem is that i need the persistence of another property that isn't a
    collection.
    The property is a class derived from Control:

    private SimpleControlClass simpleControl;
    public SimpleControlClass SimpleControl
    {
    get
    {
    if (simpleControl == null)
    simpleControl = new SimpleControlClass();
    return simpleControl;
    }
    }

    How can i have the persistence of this property?
    I need an ASPX code like:

    <cc:myControl>
    <cc:SimpleControlClass Property1="SampleProperty"/>
    <collection1>
    <cc:innerControl id="innerControl11"/>
    <cc:innerControl id="innerControl12"/>
    </collection1>
    <collection2>
    <cc:innerControl id="innerControl21"/>
    <cc:innerControl id="innerControl22"/>
    </collection1>
    </cc:myControl>

    Could you help me, please?

    Thanx a lot.


    LucaP Guest

  2. Similar Questions and Discussions

    1. Problem with DataGrid persistence
      Hi!! I'm building a component that operate on on a datagrid. My variable declaration : private DataGrid m_DataGrid; My DataGrid...
    2. Persistence
      Hi, I have a datagrid with a checkbox column. The datagrid is using paging and sorting. When I click on a checkbox then go to page 2 (or any...
    3. Controls Persistence Properties
      Hi, I am facing problems in persisting the properties of the controls. which i make i had read also the walk through in ms help, and able to store...
    4. Collection Persistence
      All, I'm sorry for asking this cause I know it has been asked a thousand times before, but I don't seem to be able to find a complete solution...
    5. object persistence
      I instatiate an object first time when an asp.net page loads. But when the page reloads after Post Back, I get an error saying the object does not...
  3. #2

    Default Re: help for properties persistence

    Hi,

    you can persiste simple property as your control tag attribute (same as
    font) by decorating propery with DesignerSerializationVisibility.Content

    [
    DesignerSerializationVisibility(
    DesignerSerializationVisibility.Content),
    NotifyParentProperty(true)
    ]
    public FontInfo Font { ... }

    HTH

    Natty Gur[MVP]

    blog : [url]http://weblogs.asp.net/ngur[/url]
    Mobile: +972-(0)52-8888377


    *** Sent via Devdex [url]http://www.devdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Natty Gur Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139