CodeDomSerializer

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Björn Marthen

    #1

    CodeDomSerializer

    Hi,

    I have written a custom web control with a DesignSerialize r.
    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


  • IgorW

    #2
    Re: CodeDomSerializ er

    Björn Marthen schrieb:[color=blue]
    > Hi,
    >
    > I have written a custom web control with a DesignSerialize r.
    > 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
    >
    >[/color]
    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.Componen tModel.Design.S erialization.ID esignerSerializ ationManager,
    ByVal value As Object) As Object

    'ms-help://MS.VSCC.2003/MS.MSDNQTR.2003 APR.1033/cpref/html/frlrfSystemComp onentModelDesig nSerializationC odeDomSerialize rClassTopic.htm
    Dim BaseSerializer As CodeDomSerializ er =
    manager.GetSeri alizer(GetType( MyControl).Base Type,
    GetType(CodeDom Serializer))
    Dim codeObject As Object =
    BaseSerializer. Serialize(manag er, value)
    Dim oMyControl As MyControl= CType(value, MyControl)
    ....
    now you can serialize the code and use your control.

    Comment

    Working...