J
jahyen
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
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