More in this section

Forums / Developing with Sitefinity / document library batch edit not saving custom metadata

document library batch edit not saving custom metadata

2 posts, 0 answered
  1. michael
    michael avatar
    20 posts
    Registered:
    09 Jan 2009
    04 Feb 2009
    Link to this post
    I have added a custom metadata, called PublishDate, to the document library.  It is working great when I edit a single document.  However, the batch edit is doing some strange things.

    I have updated the BatchEditor.ascx so that the new PublishDate is displayed and can be edited.  However, when I click 'save changes' I get one of two outcomes: the dates that i just set are not saved or the dates on documents that were already set are cleared.

    As you can imagine this is a bit frustrating (and the bit about clearing previously set dates is very troubling).  Can you give suggestions on how this issue can be addressed?

    Here is the bit of the template that I updated:

    <sf:ContentMetaFields ID="Default" runat="server" Visible="false">
                                    <ItemTemplate>
                                        <dt>
                                            <br />
                                            <asp:Label ID="Label1" runat="server" AssociatedControlID="Name" Text="<%$Resources:Title %>"></asp:Label>
                                            <asp:TextBox ID="Name" runat="server"></asp:TextBox>
                                            <asp:RequiredFieldValidator ValidationGroup="editItems" ID="RequiredFieldValidator2" runat="server" ControlToValidate="Name" Display="Dynamic" EnableViewState="False" CssClass="validMessage" SetFocusOnError="True"><strong><asp:Literal ID="Literal8" runat="server" Text="<%$Resources:TitleEmpty %>"></asp:Literal></strong></asp:RequiredFieldValidator>
                                            <asp:RegularExpressionValidator ValidationGroup="editItems" ID="RegularExpressionValidator2" Runat="server" ValidationExpression='[^\\/:*?"<>|]+' ControlToValidate="Name" Display="Dynamic" EnableViewState="False" CssClass="validMessage" SetFocusOnError="True"><strong><asp:Literal ID="Literal7" runat="server" Text="<%$Resources:FileNameRestrictions %>"></asp:Literal></strong></asp:RegularExpressionValidator>
                                        </dt>
                                        <dd>
                                            <asp:Label ID="Label2" runat="server" AssociatedControlID="Author" Text="<%$Resources:Author %>"></asp:Label>
                                            <asp:TextBox ID="Author" runat="server"></asp:TextBox>
                                        </dd>
                                        <dd>
                                            <asp:Label ID="Label3" runat="server" AssociatedControlID="Description" Text="<%$Resources:Description %>"></asp:Label>
                                            <asp:TextBox ID="Description" runat="server" TextMode="MultiLine"></asp:TextBox>
                                        </dd>
                                        <dd>
                                            <asp:Label ID="Label5" runat="server" AssociatedControlID="PublishDate" Text="PublishDate*"></asp:Label>
                                            <telerik:raddatepicker ID="PublishDate" runat="server" ></telerik:raddatepicker>
                                            <asp:CompareValidator ValueToCompare="1980/01/01" Type="Date" Operator="GreaterThan" runat="server" ID="rangeValidator" ValidationGroup="editItems" ControlToValidate="PublishDate" Display="Dynamic" EnableViewState="false" CssClass="validMessage" SetFocusOnError="true"><strong>Date Must be in the last 25 years</strong></asp:CompareValidator>
                                        </dd>
                                    </ItemTemplate>
                                </sf:ContentMetaFields>
  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    09 Feb 2009
    Link to this post
    Hi Michael,

    I was able to save the Metafields by following these steps:
    1. web.config entries:
     <add key="Libraries.PublishDate" valueType="DateTime" visible="True" searchable="True" sortable="True" defaultValue="#Now"/> 
    then for the document type:
    <add name="Document"  
    title="Document Library"  
    defaultExtenstions=".doc, .docx, .rtf, .txt, .pdf, .ppt, .pptx, .html, .xls, .xlsx"  
    metaKeys="Author, Description, Extension, Name, Size, Category, PublishDate"
    </add> 

    2. [MyProject]\Sitefinity\Admin\ControlTemplates\Libraries\BatchEditor.ascx:
    <sf:ContentMetaFields ID="Image" runat="server" Visible="false"
        <ItemTemplate> 
            <dt> 
                <asp:Label runat="server" AssociatedControlID="Name" Text="<%$Resources:Title %>"></asp:Label> 
                <asp:TextBox ID="Name" runat="server"></asp:TextBox> 
                <asp:RequiredFieldValidator ValidationGroup="editItems" ID="RequiredFieldValidator1" runat="server" ControlToValidate="Name" Display="Dynamic" EnableViewState="False" CssClass="validMessage" SetFocusOnError="True"><strong><asp:Literal ID="Literal8" runat="server" Text="<%$Resources:TitleEmpty %>"></asp:Literal></strong></asp:RequiredFieldValidator> 
                <asp:RegularExpressionValidator ValidationGroup="editItems" ID="RegularExpressionValidator2" Runat="server" ValidationExpression='[^\\/:*?"<>|]+' ControlToValidate="Name" Display="Dynamic" EnableViewState="False" CssClass="validMessage" SetFocusOnError="True"><strong><asp:Literal ID="Literal7" runat="server" Text="<%$Resources:FileNameRestrictions %>"></asp:Literal></strong></asp:RegularExpressionValidator> 
            </dt> 
            <dd> 
                <asp:Label runat="server" AssociatedControlID="AlternateText" Text="<%$Resources:Alternative %>"></asp:Label> 
                <asp:TextBox ID="AlternateText" runat="server"></asp:TextBox> 
            </dd> 
         <li> 
            <asp:Label ID="Label9" runat="server" AssociatedControlID="PublishDate" Text="Publish Date:"></asp:Label> 
            <asp:TextBox runat="server" ID="PublishDate"></asp:TextBox>                                     
        </li> 
        </ItemTemplate> 
    </sf:ContentMetaFields> 
    <asp:PlaceHolder runat="server" ID="infoHolder" Visible="false"
        <dd class="doctype"
            <asp:Panel runat="server" ID="itemInfo"
                <asp:Label runat="server" ID="itemName"></asp:Label> 
            </asp:Panel> 
        </dd> 
    </asp:PlaceHolder> 
    <sf:ContentMetaFields ID="Default" runat="server" Visible="false"
        <ItemTemplate> 
        <li> 
            <asp:Label ID="Label9" runat="server" AssociatedControlID="PublishDate" Text="Publish Date:"></asp:Label> 
            <asp:TextBox runat="server" ID="PublishDate"></asp:TextBox>                                     
        </li> 
            <dt> 
                <asp:Label ID="Label1" runat="server" AssociatedControlID="Name" Text="<%$Resources:Title %>"></asp:Label> 
                <asp:TextBox ID="Name" runat="server"></asp:TextBox> 
                <asp:RequiredFieldValidator ValidationGroup="editItems" ID="RequiredFieldValidator2" runat="server" ControlToValidate="Name" Display="Dynamic" EnableViewState="False" CssClass="validMessage" SetFocusOnError="True"><strong><asp:Literal ID="Literal8" runat="server" Text="<%$Resources:TitleEmpty %>"></asp:Literal></strong></asp:RequiredFieldValidator> 
                <asp:RegularExpressionValidator ValidationGroup="editItems" ID="RegularExpressionValidator2" Runat="server" ValidationExpression='[^\\/:*?"<>|]+' ControlToValidate="Name" Display="Dynamic" EnableViewState="False" CssClass="validMessage" SetFocusOnError="True"><strong><asp:Literal ID="Literal7" runat="server" Text="<%$Resources:FileNameRestrictions %>"></asp:Literal></strong></asp:RegularExpressionValidator> 
            </dt> 
            <dd> 
                <asp:Label ID="Label2" runat="server" AssociatedControlID="Author" Text="<%$Resources:Author %>"></asp:Label> 
                <asp:TextBox ID="Author" runat="server"></asp:TextBox> 
            </dd> 
            <dd> 
                <asp:Label ID="Label3" runat="server" AssociatedControlID="Description" Text="<%$Resources:Description %>"></asp:Label> 
                <asp:TextBox ID="Description" runat="server" TextMode="MultiLine"></asp:TextBox> 
            </dd> 
        </ItemTemplate> 
    </sf:ContentMetaFields> 

    Attached is the file for your convenience. Let me know if I am missing something.

    Sincerely yours,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
2 posts, 0 answered