Thank you Both ForYour answers. I used the combination of your answers to
solve my issue and it works great! Here is what my class ends up looking like
<Serializable() > _
Class TabMenuItem
....
<NonSerialized( )> Private _RenderControl As
System.Web.UI.W ebControls.WebC ontrol
....
<System.Xml.Ser ialization.XmlI gnore()> _
Property RenderControl() As System.Web.UI.W ebControls.WebC ontrol
Get
If Not _RenderControl Is Nothing Then
Return _RenderControl
Else
_RenderControl =
System.Activato r.CreateInstanc e(ControlType)
_RenderControl. ID = ControlId
Return _RenderControl
End If
End Get
Set(ByVal Value As System.Web.UI.W ebControls.WebC ontrol)
_RenderControl = Value
ControlType = Value.GetType
ControlId = Value.ID
End Set
End Property
....
End Class
"Earl Teigrob" wrote:
I have a class that has some fields and properties that I want to serialize.
However, one of the fields is of type System.Web.UI.W ebcontrols.Webc ontrol
and it will not serialize so I want to mark it as "NonSerialized" . However,
this property is not allowed on a property of this type. How can I designate
this property so that I can serialize the rest of the call without
serializing this property???
Thanks!
Property myControl() As System.Web.UI.W ebControls.WebC ontrol
Get
Return _myControl
End Get
Set(ByVal Value As System.Web.UI.W ebControls.WebC ontrol)
_myControl = Value
End Set
End Property