CodeDomSerializer

B

Björn Marthen

Hi,

I have written a custom web control with a DesignSerializer.
If i change a property in design-time, the serializer starts before the
properties will be set in the control (the object "value" in the serialize
method has the old property value). Thats annoying cause the serialize
should write somthing to the code that depends on the property.

Does anyone know a solution for my problem?

regards,
Björn Marthen
 
I

IgorW

Björn Marthen said:
Hi,

I have written a custom web control with a DesignSerializer.
If i change a property in design-time, the serializer starts before the
properties will be set in the control (the object "value" in the serialize
method has the old property value). Thats annoying cause the serialize
should write somthing to the code that depends on the property.

Does anyone know a solution for my problem?

regards,
Björn Marthen
Hi Björn,

in the Method Serialize in your Serializer, the last parameter is your
control. you can access its properties and serialize values.

Public Overrides Function Serialize(ByVal manager As
System.ComponentModel.Design.Serialization.IDesignerSerializationManager,
ByVal value As Object) As Object

'ms-help://MS.VSCC.2003/MS.MSDNQTR.2003APR.1033/cpref/html/frlrfSystemComponentModelDesignSerializationCodeDomSerializerClassTopic.htm
Dim BaseSerializer As CodeDomSerializer =
manager.GetSerializer(GetType(MyControl).BaseType,
GetType(CodeDomSerializer))
Dim codeObject As Object =
BaseSerializer.Serialize(manager, value)
Dim oMyControl As MyControl= CType(value, MyControl)
....
now you can serialize the code and use your control.
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top