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

Forums / Bugs & Issues / Add Order Date to Image/Docs

Add Order Date to Image/Docs

2 posts, 0 answered
  1. Kieran
    Kieran avatar
    56 posts
    Registered:
    14 Aug 2008
    09 Jun 2010
    Link to this post
    Hi,

    I am trying to add a date to the Images/Document module so that I can sorted them in the front end.

    I have added a RadDateTimePicker to the LibraryItemEdit.ascx and all works fine. But when I add this to the LibraryItemBatchEdit.ascx it just clears the value that is saved.

    If I change the RadDateTimePicker with a TextBox it works fine again.


    <sf:ContentMetaFields ID="Default" runat="server" Visible="false">
                                   <ItemTemplate>
                                       <dt>
                                           <asp:Label ID="Label3" runat="server" AssociatedControlID="Name" Text="<%$Resources:BatchEdit_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="Literal3" runat="server" Text="<%$Resources:BatchEdit_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="Literal10" runat="server" Text="<%$Resources:BatchEdit_FileNameRestrictions %>"></asp:Literal></strong></asp:RegularExpressionValidator>
                                       </dt>
                                       <dd>
                                           <asp:Label ID="Label4" runat="server" AssociatedControlID="Author" Text="<%$Resources:BatchEdit_Author %>"></asp:Label>
                                           <asp:TextBox ID="Author" runat="server"></asp:TextBox>
                                       </dd>
                                       <dd>
                                           <asp:Label ID="Label5" runat="server" AssociatedControlID="Description" Text="<%$Resources:BatchEdit_Description %>"></asp:Label>
                                           <asp:TextBox ID="Description" runat="server" TextMode="MultiLine"></asp:TextBox>
                                       </dd>
                                       <dd>
                                           <asp:Label ID="lblOrderDate" runat="server" AssociatedControlID="OrderDate" Text="Order Date" />
                                           <telerik:RadDateTimePicker ID="OrderDate" runat="server" />
                                       </dd>
                                   </ItemTemplate>
                               </sf:ContentMetaFields>

    Thanks
    Kieran
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    09 Jun 2010
    Link to this post
    Hello Kieran,

    You can use controls of type RadDateInput or RadDatePicker. RadDateTimePicker is not supported which means that you need to persist the value manually. To persist the value manually you have to create a code behind of the view. Access the RadDateTimePicker in the ContentMetaFields control and set the metakey by calling SetMetaData method. The same applies when you retrieve the data. You have to get the content item and call GetMetaData method and set it to the RadDatetimePciker


    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Telerik.Cms.Engine.WebControls;
    using Telerik.Web.UI;
    using Telerik.Cms.Engine;
    using System.Collections;
      
    public partial class Sitefinity_Admin_ControlTemplates_Libraries_LibraryItemBatchEdit : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            itemList.ItemDataBound += new RepeaterItemEventHandler(itemList_ItemDataBound);
      
        }
      
        void itemList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                ContentMetaFields cmf = e.Item.FindControl("Default") as ContentMetaFields;
                RadDateTimePicker picker = cmf.Controls[0].FindControl("CountDate") as RadDateTimePicker ;
                    if (picker != null)
                    {
                        // do other logic here
     
                    
            }
                 
        }
    }


    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.
2 posts, 0 answered