More in this section

Forums / Developing with Sitefinity / Create custom generic_content module

Create custom generic_content module

2 posts, 0 answered
  1. Paul
    Paul avatar
    176 posts
    Registered:
    18 Nov 2008
    18 May 2009
    Link to this post

    Hi!

    I have read a lot of articles(for example http://www.josephguadagno.net/Articles/1/Technical-Articles/10/Creating-a-new-Sitefinity-generic-content-module.aspx) about creation custom generic_content module but I don't understand how I can set the template for create,edit or view my items of new module. When I am trying to create new item I see the standard template of generic_content. What am I doing wrong? 

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    18 May 2009
    Link to this post
    Hi Paul,

    This article refers to the old architecture of Sitefinity.

    Currently you need to create a view and for each of these views you can set embedded templates.

    Sample code.

    namespace Sitefinity.Samples.Admin 
        public class CustomView : ViewModeControl<MyControlPanel>, IGenericContentHost 
        { 
            /// <summary> 
            /// Content Manager used by the control 
            /// </summary> 
            public ContentManager Manager 
            { 
                get 
                { 
                    return this.Host.Manager; 
                } 
            } 
     
            public MyModuleManager MyManager 
            { 
                get 
                { 
                    return this.Host.MyManager; 
                } 
            } 
            protected override void CreateViews() 
            { 
                AddView<CustomItemListView>("CustomItemListView""Title""Description"null, Messages.ResourceManager); 
                AddView<CustomEditView>("CustomEditView""Title""Description"null, Messages.ResourceManager); 
                AddView<CustomHistoryView>("CustomHistoryView""Title""Description"null, Messages.ResourceManager); 
                AddView<CustomNewView>("CustomNewView""STitle""Description"null, Messages.ResourceManager); 
                AddView<CustomPreviewView>("CustomPreviewView""Title""Description"null, Messages.ResourceManager); 
            } 
        } 
     

    Then in each view you can set the template that should be used for it.

     
        public class CustomNewView : ContentItemNew<CustomView> 
        { 
            #region View layout and template 
     
            /// <summary> 
            /// Gets or sets the path to a custom layout template for the control. 
            /// </summary> 
            /// <value></value> 
            [WebSysTemplate(CustomNewView.layoutTemplateName, "Desc""/Custom"false"2009-04-10")] 
            public override string LayoutTemplatePath 
            { 
                get 
                { 
                    return base.LayoutTemplatePath; 
                } 
                set 
                { 
                    base.LayoutTemplatePath = value; 
                } 
            } 
     
            protected override string LayoutTemplateName 
            { 
                get 
                { 
                    return CustomNewView.layoutTemplateName; 
                } 
            } 
     
            private const string layoutTemplateName = 
                "Sitefinity.Samples.CustomModule.Resources.ControlTemplates.Backend.CustomNewView.ascx"
            #endregion 

    More information at Sitefinity 3.6 new backend architecture - documentation outline

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