Persistence problem with custom control property using PersistenceMode.InnerProperty

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 contents of the ASPX file only contains the attribute, not the inner
property:

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

Here's the code I'm testing with:

'-------------------------------------------------------------
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
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top