CodeDomSerializer

Discussion in 'ASP .Net Web Controls' started by Björn Marthen, Nov 10, 2003.

  1. 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
    Björn Marthen, Nov 10, 2003
    #1
    1. Advertising

  2. Björn Marthen

    IgorW Guest

    Björn Marthen schrieb:
    > 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.
    IgorW, Nov 13, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. onyxring
    Replies:
    1
    Views:
    2,791
    onyxring
    Feb 13, 2006
Loading...

Share This Page