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

Forums / Developing with Sitefinity / Archive work only with publication date

Archive work only with publication date

4 posts, 0 answered
  1. Manoj
    Manoj avatar
    20 posts
    Registered:
    23 Oct 2008
    06 Feb 2009
    Link to this post
    I am using News archive in Events section for display events archive but i found it only work with publication date not expiration date/event start/ event end date.


  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    06 Feb 2009
    Link to this post
    Hi Manoj,

    You cannot directly use News archive control for Events provider. ArchiveItemKey and ArchiveProviderKey are different and hardcoded.

    The solution is using one base control and override its porperites.

    Example:

    Here we override ContentProviderKey and ContentItemKey. We set them as browsable to falls so they are not visible. We will create  two new porperties and assign their's value to the get
    accessor of the ContentProviderKey and ContentItemKey because we cannot use set accessor.

    This is an example using the same way you could override other properties.


    using System; 
    using System.Collections.Generic; 
    using System.Web; 
    using Telerik.Cms.Engine.WebControls; 
    using System.ComponentModel; 
     
    /// <summary> 
    /// Summary description for CustomcontentArchive 
    /// </summary> 
    ///  
    namespace Telerik.Samples 
        public class CustomcontentArchive :ContentArchive 
        { 
            public CustomcontentArchive() 
            { 
            } 
     
            public string ArchiveProviderKey 
            { 
                get 
                { 
                    return this.archiveProviderKey; 
                } 
                set 
                { 
                    this.archiveProviderKey = value; 
                } 
            } 
            private string archiveProviderKey; 
     
        [Browsable(false)] 
            public override string ContentProviderKey 
            { 
                get 
                { 
                    return this.archiveProviderKey; 
                } 
            } 
     
            public string ArchiveItemKey 
            { 
                get 
                { 
                    return this.archiveItemKey; 
                } 
                set 
                { 
                    this.archiveItemKey = value; 
                } 
            } 
             
            [Browsable(false)] 
            public override string ContentItemKey 
            { 
                get 
                { 
                    return this.ArchiveItemKey; 
                } 
            } 
     
     
            private string archiveItemKey; 
     
        } 
         
     

    I hope this helps.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Manoj
    Manoj avatar
    20 posts
    Registered:
    23 Oct 2008
    16 Feb 2009
    Link to this post
    I can understand but we don't have the source code . how we can override the properties?

     we have download the code from sitefinity website it is 'Sitefinity_3_2_1616_community_BlankProject.zip' after that we have download the patch that is 'Sitefinity_3_5_1747_community_patch.zip'


  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    16 Feb 2009
    Link to this post
    Hi Manoj,

    You do not need the source. You just override ContentArchive control. The code I sent you is a fully working example that you should put in App_Code folder, then register the control in your web.config file <toolboxControls> section.

     <add name="Custom Archive" section="custom" type="Telerik.Samples.CustomcontentArchive, App_Code" /> 

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
4 posts, 0 answered