Undesirable Behavior: DynamicContent.GetValue<T>(strin

Posted by Community Admin on 05-Aug-2018 00:19

Undesirable Behavior: DynamicContent.GetValue(string)

All Replies

Posted by Community Admin on 14-Mar-2013 00:00

When a text-based content item field is hidden, the following must be used to retrieve the value:

DynamicContent.GetValue<string>("field")

Otherwise:

DynamicContent.GetValue<Lstring>("field")

It's a bit annoying to have this code dependency, because the content administration can cause an exception in previously valid code by changing an existing field to hidden or not hidden.

Posted by Community Admin on 18-Mar-2013 00:00

Hello,


When Sitefinity 5.3 was released, we introduced Multilingual for 5.3, so by default all new fields that are created in a custom module, built with the module builder, are localizable. However the old fields are not converted to LStrings, but you have the option to convert them to such type. In order to achieve this, you can go to the backend page, which lists all fields for the content type of your custom module. Then if you edit each one of the fields, you will see an option:

"Make localizable" which when clicked will convert your old data type to Lstring.

If one of your custom fields is localizable and the other one is not, it is normal that to get the first field you need to use GetValue<string> and to get the second one: GetValue<Lstring>. Please review your custom fields in the backend of Sitefinity.

All the best,
Stefani Tacheva
the Telerik team
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

Posted by Community Admin on 03-Jun-2013 00:00

Agreed, this is confusing. The consumer shouldn't have to worry about Lstring, or string. 

Posted by Community Admin on 06-Jun-2013 00:00

Hi Adam,

Thank you for your feedback.

Regards,
Stefani Tacheva
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