Can I use TypeConverterAttribute to decorate a public proper

Posted by Community Admin on 04-Aug-2018 04:10

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

All Replies

Posted by Community Admin on 04-Dec-2013 00:00
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
Posted by Community Admin on 06-Dec-2013 00:00
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
This thread is closed