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

Forums / Developing with Sitefinity / GenericContent Metadata defaultValue

GenericContent Metadata defaultValue

4 posts, 1 answered
  1. Olivier
    Olivier avatar
    57 posts
    Registered:
    09 Jul 2010
    18 Nov 2010
    Link to this post
    Hi,

    I wanted to know if the defaultValue of a MetaData is automatically applied for a generic content that I create programmatically.

    Or do I have to set it programmatically too ?

    And also, this is valid, right ?
    valueType="DateTime" [...] defaultValue="#Now"

    Thank you,

    Olivier
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    18 Nov 2010
    Link to this post
    Hello Olivier,

    You have to use DateTime.Now and the public methods of DateTime class.

    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Olivier
    Olivier avatar
    57 posts
    Registered:
    09 Jul 2010
    18 Nov 2010
    Link to this post
    Sorry, maybe I havent been clear enough...

    The things I was asking if it was valid is in fact this line:

    <add key="Libraries.PublishDate" valueType="DateTime" visible="True" searchable="True" sortable="True" defaultValue="#Now"/>

    A custom metadata I added to <metaFields> in <cmsEngine­> part of the config file.

    But for files I added programmatically, the defaultValue was not set.

    Is it normal, or not ?

    Thanks
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    18 Nov 2010
    Link to this post
    Hello Olivier,

    When you work progtrammatically you should set the value. You have to call Manager.SetMetaData(info.Key, data); We do this internally when you work with the UI

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
Register for webinar
4 posts, 1 answered