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

Forums / Developing with Sitefinity / Unable to persist new MetaData field for DocumentLibrary

Unable to persist new MetaData field for DocumentLibrary

3 posts, 1 answered
  1. clayman
    clayman avatar
    38 posts
    Registered:
    23 Sep 2009
    24 Mar 2010
    Link to this post
    I'm having a problem adding a new meta field to the document library.  All I need is to store a "display date" which will allow users to specify the datetime that the document should be shown as published.

    I've added a new key in the config:
    <add key="Libraries.DisplayDate" valueType="ShortText" visible="True" searchable="True" sortable="True" defaultValue=""/>

    I added a reference to the view in the config.xml file:
    <!--Edit library item properties - Images & Documents.-->
        <viewSettings hostType="Telerik.Libraries.WebControls.Admin.LibraryItemEdit" layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Libraries/LibraryItemEdit.ascx" />

    and in the edit template control I added a new label and textbox to fit right under the author and description fields:
    <fieldset class="set">
                                <ol class="setIn">
                                    <li>
                                        <asp:Label ID="Label7" AssociatedControlID="Author" runat="server" Text="<%$Resources:ItemEdit_Author %>"></asp:Label>
                                        <asp:TextBox runat="server" ID="Author"></asp:TextBox>
                                    </li>
                                    <li>
                                        <asp:Label ID="Label5" runat="server" AssociatedControlID="Description" Text="<%$Resources:ItemEdit_DocumentDescription %>"></asp:Label>
                                        <asp:TextBox runat="server" ID="Description" TextMode="MultiLine"></asp:TextBox>
                                    </li>
                                    <li>
                                        <asp:Label ID="Label10" AssociatedControlID="DisplayDate" runat="server" Text="<%$Resources:ItemEdit_DisplayDate %>"></asp:Label>
                                        <asp:TextBox runat="server" ID="DisplayDate"></asp:TextBox>
                                    </li>
                                </ol>
                            </fieldset>

    this all appears to work, but nothing is saving in my new field.

    I know the mapping is correct because if I change the data type to datetime and set the default value of the meta field to NOW (in the .config) I get the datetime displayed on the page.

    What do I need to do in order to get my custom field to persist?
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    25 Mar 2010
    Link to this post
    Hi clayman,

    Thank you for using our services.

    Did you add the DisplayDate meta field to the Documents type library in the web.config:
    <add name="Document" title="Document Library" defaultExtenstions=".doc, .docx, .rtf, .txt, .pdf, .ppt, .pps, .pptx, .html, .xls, .xlsx" metaKeys="Author, DisplayDate, Description, Extension, Name, Size, Category"></add>

    Also, please check if you have added the DisplayDate in the correct ContentMetaFields ItemTemplate in the LibraryItemEdit.ascx file. There are two of those - one for image libraries and one for the rest of the types.

    Greetings,
    Radoslav Georgiev
    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
  3. clayman
    clayman avatar
    38 posts
    Registered:
    23 Sep 2009
    25 Mar 2010
    Link to this post
    that was the problem - I didn't add it to the other config element.  Thanks!
Register for webinar
3 posts, 1 answered