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

Forums / Module Builder / Undesirable Behavior: DynamicContent.GetValue(string)

Undesirable Behavior: DynamicContent.GetValue<T>(string)

4 posts, 0 answered
  1. Gary
    Gary avatar
    91 posts
    Registered:
    19 Jul 2007
    14 Mar 2013
    Link to this post
    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.
  2. Stefani Tacheva
    Stefani Tacheva avatar
    718 posts
    Registered:
    06 Dec 2016
    18 Mar 2013
    Link to this post
    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
  3. Adam
    Adam avatar
    23 posts
    Registered:
    05 Apr 2013
    03 Jun 2013 in reply to Stefani Tacheva
    Link to this post
    Agreed, this is confusing. The consumer shouldn't have to worry about Lstring, or string. 
  4. Stefani Tacheva
    Stefani Tacheva avatar
    718 posts
    Registered:
    06 Dec 2016
    06 Jun 2013
    Link to this post
    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
4 posts, 0 answered