More in this section

Forums / Developing with Sitefinity / MetaFields not working on Libraries

MetaFields not working on Libraries

5 posts, 0 answered
  1. Bruno Michels
    Bruno Michels avatar
    125 posts
    Registered:
    16 Apr 2010
    17 May 2010
    Link to this post
    Web.config <metaFields>
    <add key="Libraries.Width" valueType="Integer" visible="True" searchable="True" sortable="True" defaultValue="" mandatory="true"/>
    <add key="Libraries.Height" valueType="Integer" visible="True" searchable="True" sortable="True" defaultValue=""/>

    Web.config <libraryInfo>
    <libraryInfo>
        <add name="Image" title="Image Library" defaultExtenstions=".png, .jpg, .jpeg, .gif" metaKeys="Author, AlternateText, Extension, Name, Height, Width, Size, Category, Width, Height">
        </add>
    </libraryInfo>

    LibraryNew.ascx
    <fieldset class="set">
        <div class="setIn title">
            <sf:ContentMetaFields ID="MetaFields" runat="server">
                <ItemTemplate>
                    <asp:TextBox ID="Width" runat="server" />
                    <asp:TextBox ID="Height" runat="server" />
                </ItemTemplate>
            </sf:ContentMetaFields>
        </div>
    </fieldset>

    ControlsConfig.xml
    <!--Creates a new library.-->
    <viewSettings hostType="Telerik.Libraries.WebControls.Admin.LibraryNew`1[[Telerik.Libraries.WebControls.Admin.LibrariesView, Telerik.Libraries]]" layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Libraries/LibraryNew.ascx" />

    So, I've added the metaFields on web.config, added to Image Library, mapped the external template and added the code.

    When I create a new gallery it doesn't save the values I entered on sf_GCMetaData.
    When I do the same thing for News it works perfectly.

    Am I doing anything wrong?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    17 May 2010
    Link to this post
    Hello Bruno Michels,

    The metafields are valid for IContent objects. You cannot use metakeys to persist ILibrary properties. ILibrary properties are persisted in [sf_Libraries] table.

    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.
  3. Bruno Michels
    Bruno Michels avatar
    125 posts
    Registered:
    16 Apr 2010
    17 May 2010
    Link to this post
    What about some metaFields that are save on GCMetaData?

    KeyValue       Application   ShortText
    Author         /Libraries       XXX
    Category       /Libraries       XXX
    Description    /Libraries       XXX

    How is it saved there?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    17 May 2010
    Link to this post
    Hi Bruno Michels,

    IContent has method SetMetaData. You can gather more information and see several examples at Modifying Content Items

    Greetings,
    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.
  5. Bruno Michels
    Bruno Michels avatar
    125 posts
    Registered:
    16 Apr 2010
    17 May 2010
    Link to this post
    My bad, I noticed now that Libraries aren't content, but the images are, I got a bit confused.

    Thanks for your help.
Register for webinar
5 posts, 0 answered