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

Forums / Developing with Sitefinity / Customizing Events View

Customizing Events View

6 posts, 0 answered
  1. Ricardo
    Ricardo avatar
    11 posts
    Registered:
    21 Jan 2009
    14 May 2009
    Link to this post
    Hello,

    I would like to customize the events module, but I am having trouble finding what I need. Here is what I am looking to do:

    • I would like to remove some fields. For example, Country and State are not applicable for me.
    • I would liek to change the Events View Template, but I am having trouble finding the original one. I know I can build my own, I was just hoping I could modify an existing one.

    Thanks for your help,
    -Ricardo

    PD. By the way, thanks for all the speedy answers I've been getting. I really appreciated it.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    14 May 2009
    Link to this post
    Hello Ricardo,

    I would like to remove some fields. For example, Country and State are not applicable for me.

    Country and State are metakys for events module. If you want to remove them when creating or editing a content item you should map the external templates EventsItemEdit and EvventsItemNew

    Sample mapping:

     <viewSettings hostType="Telerik.Events.WebControls.Admin.EventsItemNew" layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Events/EventsItemNew.ascx" /> 
     
    <viewSettings hostType="Telerik.Events.WebControls.Admin.EventsItemEdit" layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Events/EventsItemEdit.ascx" /> 

    The layoutTemplatePath is the path where your external template is located.
    The you can remove the metakeys - textboxes and label. You can also comment the keys in your web.config file.

    I would liek to change the Events View Template, but I am having trouble finding the original one. I know I can build my own, I was just hoping I could modify an existing one.


    If you want to change the front end templates - that shows the event items on the public site you can map
    ListPageMaste and ListPageDetails templates directly through the Control Designer ( you can get the templates from MyClient.net - there is an archive file with all external templates)  .Open the control in edit mode >> Advanced >> Apperiance >> SitngleItemTemplatePAth and ItemListTemplatePath.

    Let us know if there is anything else that we can do for you.

    Sincerely yours,
    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.
  3. Ricardo
    Ricardo avatar
    11 posts
    Registered:
    21 Jan 2009
    14 May 2009
    Link to this post
    Ivan, thanks for your reply.

    On my project I can not find: ~/Sitefinity/Admin/ControlTemplates/Events/EventsItemNew.ascx

    Do you know why that would be?

    Thanks,
    -Ricardo
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    14 May 2009
    Link to this post
    Hello Ricardo,

    "The layoutTemplatePath is the path where your external template is located." You can download the external templates from MyClient.net.

    More information abut the mapping can be found at
    http://www.sitefinity.com/support/knowledge-base/kb-article/b1154K-bcge-b1154T-cgb.aspx
    http://blogs.sitefinity.com/Ivan/Posts/09-02-23/Mapping_a_control_to_use_external_template.aspx

    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.
  5. Ricardo
    Ricardo avatar
    11 posts
    Registered:
    21 Jan 2009
    17 May 2009
    Link to this post
    Ivan,

    Thanks for all your help.

    I've done exactly what you mentioned above, but I am getting this error: 

    A required control was not found in the template for"~/Sitefinity/Admin/ControlTemplates/Events/EventsItemNew.ascx". The controlmust be assignable form type "System.Web.UI.WebControls.ListControl" and musthave ID "Country".

    I have already removed Events.Country from the Meta Keys, but is still think is required.  I looked for other references to this field and I found one in the <genericProvider> tag of events, but If I remove "countryField" from there, I get the following configuration error: 

    Required attribute 'countryField' not found.

    Any ideas?

    Thanks,
    -Ricardo

  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    18 May 2009
    Link to this post
    Hi Ricardo,

    The control is set as required in the view when you are creating or editing new items. If you want to remove it, you should create your custom view with control, you can just override the default one EventsItemEdit and set some controls as not required.

    Here is a sample:

    using System; 
    using System.Collections.Generic; 
    using System.Linq; 
    using System.Web; 
    using Telerik.Events.WebControls.Admin; 
    using Telerik.Cms.Engine.WebControls.Admin; 
    using System.Web.UI.WebControls; 
    using System.Web.UI; 
     
    /// <summary> 
    /// Summary description for CustomEventsItemEdit 
    /// </summary> 
    public class CustomEventsItemEdit : EventsItemEdit 
        public CustomEventsItemEdit() 
        { 
        } 
     
        public override System.Type AssemblyInfo 
        { 
            get 
            { 
                return typeof(EventsItemEdit); 
            } 
            set 
            { 
                base.AssemblyInfo = value; 
            } 
        } 
     
        public override Type LocalizationAssemblyInfo 
        { 
            get 
            { 
                return typeof(EventsItemEdit); 
            } 
            set 
            { 
                base.LocalizationAssemblyInfo = value; 
            } 
        } 
     
        public override string LayoutTemplatePath 
        { 
            get 
            { 
                return this.LayoutTemplatePath ="~/ExternalTemplates/CustomEventsItemEdit.ascx"
            } 
            set 
            { 
               this.layoutTemplatePath = value; 
            } 
        } 
        private string layoutTemplatePath; 
     
        protected override ListControl State 
        { 
            get 
            { 
                return base.Container.GetControl<ListControl>("State"false, Telerik.Framework.Web.TraverseMethod.BreadthFirst); 
            } 
        } 

    Then you can replace the view in your ControlsConfig file.

    <viewSettings hostType="Telerik.Events.WebControls.Admin.EventsItemEdit, Telerik.Events">  
          <views>  
            <remove name="EventsItemEdit"></remove>  
            <add name="EventsItemEdit" viewType="CustomEventsItemEdit, App_Code"></add>  
          </views>  
    </viewSettings>  


    All the best,
    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
6 posts, 0 answered