+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Can I use TypeConverterAttribute to decorate a public property of a user control widget?

Can I use TypeConverterAttribute to decorate a public property of a user control widget?

2 posts, 0 answered
  1. Michael
    Michael avatar
    41 posts
    Registered:
    07 Nov 2013
    04 Dec 2013
    Link to this post
    Code like:
    [System.ComponentModel.TypeConverter(typeof(System.Web.UI.WebControls.UnitConverter))]
    public uint Width
    {
       get;
       set;
    }

    While this compiles without any error, I have the feeling that Sitefinity is just ignoring it. What attributes can I use for public properties of a widget?

    I'm migrating a user control from 3.7SP4 to 6.2, and some property values are not being migrated. I'm wondering if it is because of the TypeConverter attributes.

    Thanks,
    Michael
  2. R. Atanasov
    R. Atanasov avatar
    19 posts
    Registered:
    03 Nov 2014
    06 Dec 2013
    Link to this post
    Hello,

    My guess is that you've specified the wrong converter type - UnitConverter. Please note that uint (short for unsigned integer), which is the property type, is not the same as Unit (as measuring unit). Most probably trying to use the specified converter fails and that's why the property is ignored.

    Please try specifying either an UInt32Converter (as uint is the C# alias for System.UInt32) or no converter at all, as .NET is smart enough to figure it out in this case.

    Regards,
    R. Atanasov
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered