Properties with PersistenceMode.InnerProperty not saved

Discussion in 'ASP .Net Building Controls' started by jahyen, Jan 6, 2005.

  1. jahyen

    jahyen Guest

    I'm having trouble getting my custom control to save properties that are
    decorated with the PersistenceMode.InnerProperty attribute. The properties
    that are saved with PersistenceMode.Attribute are saved OK. The class below
    is built into it's own assembly, added to the toolbox and then added to a
    new web project page.

    I then set the properties using the "Properties" page for the control in the
    IDE with the page in design view. Switching to HTML view shows that only
    the property with PersistenceMode.Attribute has been saved.

    <cc1:MyTestClass id="MyTestClass1" runat="server"
    S1="a"></cc1:MyTestClass>

    Here's the control - it's pretty basic.

    '-------------------------------------------------------------
    Imports System.ComponentModel
    Imports System.Web.UI
    Imports System.Web.UI.webcontrols

    <PersistChildren(False), _
    Serializable(), _
    ParseChildren(True)> _
    Public Class MyTestClass
    Inherits Control
    Private _s1, _s2 As String
    Private _style As Style

    <DesignerSerializationVisibility(DesignerSerializationVisibility.Visible),
    _
    NotifyParentProperty(True), _
    PersistenceMode(PersistenceMode.Attribute)> _
    Public Property S1() As String
    Get
    Return _s1
    End Get
    Set(ByVal Value As String)
    _s1 = Value
    End Set
    End Property
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Visible),
    _
    NotifyParentProperty(True), _
    PersistenceMode(PersistenceMode.InnerProperty)> _
    Public Property S2() As String
    Get
    Return _s2
    End Get
    Set(ByVal Value As String)
    _s2 = Value
    End Set
    End Property
    End Class
     
    jahyen, Jan 6, 2005
    #1
    1. Advertising

  2. hi,

    instead the of making the property to just Visible, try persisting the
    contents.
    this might help you.
    DesignerSerializationVisibility(DesignerSerializationVisibility.Content)
    for more reading
    http://msdn.microsoft.com/library/d...erializationVisibilityAttributeClassTopic.asp

    thanks,
    Kannan.V


    "jahyen" wrote:

    > I'm having trouble getting my custom control to save properties that are
    > decorated with the PersistenceMode.InnerProperty attribute. The properties
    > that are saved with PersistenceMode.Attribute are saved OK. The class below
    > is built into it's own assembly, added to the toolbox and then added to a
    > new web project page.
    >
    > I then set the properties using the "Properties" page for the control in the
    > IDE with the page in design view. Switching to HTML view shows that only
    > the property with PersistenceMode.Attribute has been saved.
    >
    > <cc1:MyTestClass id="MyTestClass1" runat="server"
    > S1="a"></cc1:MyTestClass>
    >
    > Here's the control - it's pretty basic.
    >
    > '-------------------------------------------------------------
    > Imports System.ComponentModel
    > Imports System.Web.UI
    > Imports System.Web.UI.webcontrols
    >
    > <PersistChildren(False), _
    > Serializable(), _
    > ParseChildren(True)> _
    > Public Class MyTestClass
    > Inherits Control
    > Private _s1, _s2 As String
    > Private _style As Style
    >
    > <DesignerSerializationVisibility(DesignerSerializationVisibility.Visible),
    > _
    > NotifyParentProperty(True), _
    > PersistenceMode(PersistenceMode.Attribute)> _
    > Public Property S1() As String
    > Get
    > Return _s1
    > End Get
    > Set(ByVal Value As String)
    > _s1 = Value
    > End Set
    > End Property
    > <DesignerSerializationVisibility(DesignerSerializationVisibility.Visible),
    > _
    > NotifyParentProperty(True), _
    > PersistenceMode(PersistenceMode.InnerProperty)> _
    > Public Property S2() As String
    > Get
    > Return _s2
    > End Get
    > Set(ByVal Value As String)
    > _s2 = Value
    > End Set
    > End Property
    > End Class
    >
    >
    >
    >
    >
     
    Kannan.V [MCSD.net], Jan 7, 2005
    #2
    1. Advertising

  3. jahyen

    jahyen Guest

    I tried that and it didn't/doesn't work. Any other suggestions?

    thanks!

    Jahyen

    "Kannan.V [MCSD.net]" <> wrote in
    message news:...
    > hi,
    >
    > instead the of making the property to just Visible, try persisting the
    > contents.
    > this might help you.
    > DesignerSerializationVisibility(DesignerSerializationVisibility.Content)
    > for more reading.
    > http://msdn.microsoft.com/library/d...erializationVisibilityAttributeClassTopic.asp
    >
    > thanks,
    > Kannan.V
    >
    >
    > "jahyen" wrote:
    >
    >> I'm having trouble getting my custom control to save properties that are
    >> decorated with the PersistenceMode.InnerProperty attribute. The
    >> properties
    >> that are saved with PersistenceMode.Attribute are saved OK. The class
    >> below
    >> is built into it's own assembly, added to the toolbox and then added to a
    >> new web project page.
    >>
    >> I then set the properties using the "Properties" page for the control in
    >> the
    >> IDE with the page in design view. Switching to HTML view shows that only
    >> the property with PersistenceMode.Attribute has been saved.
    >>
    >> <cc1:MyTestClass id="MyTestClass1" runat="server"
    >> S1="a"></cc1:MyTestClass>
    >>
    >> Here's the control - it's pretty basic.
    >>
    >> '-------------------------------------------------------------
    >> Imports System.ComponentModel
    >> Imports System.Web.UI
    >> Imports System.Web.UI.webcontrols
    >>
    >> <PersistChildren(False), _
    >> Serializable(), _
    >> ParseChildren(True)> _
    >> Public Class MyTestClass
    >> Inherits Control
    >> Private _s1, _s2 As String
    >> Private _style As Style
    >>
    >>
    >> <DesignerSerializationVisibility(DesignerSerializationVisibility.Visible),
    >> _
    >> NotifyParentProperty(True), _
    >> PersistenceMode(PersistenceMode.Attribute)> _
    >> Public Property S1() As String
    >> Get
    >> Return _s1
    >> End Get
    >> Set(ByVal Value As String)
    >> _s1 = Value
    >> End Set
    >> End Property
    >>
    >> <DesignerSerializationVisibility(DesignerSerializationVisibility.Visible),
    >> _
    >> NotifyParentProperty(True), _
    >> PersistenceMode(PersistenceMode.InnerProperty)> _
    >> Public Property S2() As String
    >> Get
    >> Return _s2
    >> End Get
    >> Set(ByVal Value As String)
    >> _s2 = Value
    >> End Set
    >> End Property
    >> End Class
    >>
    >>
    >>
    >>
    >>
     
    jahyen, Jan 7, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jahyen
    Replies:
    0
    Views:
    2,515
    jahyen
    Jan 6, 2005
  2. mutex
    Replies:
    0
    Views:
    222
    mutex
    Jul 27, 2003
  3. R. Myers

    PersistenceMode/DesignerSerializationVisibility problem

    R. Myers, Oct 10, 2004, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    156
    razor
    Feb 6, 2005
  4. Mike

    PersistenceMode

    Mike, Apr 1, 2005, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    126
  5. Cyril

    PersistenceMode with generic

    Cyril, Jun 29, 2005, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    116
    Cyril
    Jun 29, 2005
Loading...

Share This Page