Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Properties with PersistenceMode.InnerProperty not saved

Reply
Thread Tools

Properties with PersistenceMode.InnerProperty not saved

 
 
jahyen
Guest
Posts: n/a
 
      01-06-2005
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(DesignerSerializa tionVisibility.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(DesignerSerializa tionVisibility.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




 
Reply With Quote
 
 
 
 
Kannan.V [MCSD.net]
Guest
Posts: n/a
 
      01-07-2005
hi,

instead the of making the property to just Visible, try persisting the
contents.
this might help you.
DesignerSerializationVisibility(DesignerSerializat ionVisibility.Content)
for more reading
http://msdn.microsoft.com/library/de...ClassTopic.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(DesignerSerializa tionVisibility.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(DesignerSerializa tionVisibility.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
>
>
>
>
>

 
Reply With Quote
 
 
 
 
jahyen
Guest
Posts: n/a
 
      01-07-2005
I tried that and it didn't/doesn't work. Any other suggestions?

thanks!

Jahyen

"Kannan.V [MCSD.net]" <(E-Mail Removed)> wrote in
message news:(E-Mail Removed)...
> hi,
>
> instead the of making the property to just Visible, try persisting the
> contents.
> this might help you.
> DesignerSerializationVisibility(DesignerSerializat ionVisibility.Content)
> for more reading.
> http://msdn.microsoft.com/library/de...ClassTopic.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(DesignerSerializa tionVisibility.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(DesignerSerializa tionVisibility.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
>>
>>
>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
The properties for the Img1 element do not have the additional RoundedCornersExtender properties. AAaron123 ASP .Net 2 10-07-2009 12:34 PM
Not able to copy all properties using properties.putAll() method. Sonal Java 3 12-07-2007 03:08 AM
Setting properties (not necessarily "Properties") in Java 5.0 Wardie Java 4 11-08-2006 09:46 AM
Saved Mail Gone and Sent Mail Not Being Saved Gregg Firefox 6 03-06-2006 02:13 AM
properties not showing in properties window at design time Peter ASP .Net Building Controls 1 12-10-2003 09:04 AM



Advertisments