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

Forums / Developing with Sitefinity / Module Based On Generic Content: Reuse ContentItemsList

Module Based On Generic Content: Reuse ContentItemsList

7 posts, 0 answered
  1. William Chang
    William Chang avatar
    12 posts
    Registered:
    05 Apr 2010
    21 Apr 2010
    Link to this post
    I've been modifying the "Telerik.Samples.Products" module project I found in the Developer Manual 3.7, but I'm having trouble reusing (referencing) views in Sitefinity's modules (e.g. Generic Content, News, Blogs) in my own module. What is best and simplest approach of reusing views (e.g. removing "ProductsItemListView" code and using "Generic Content" list view made by Sitefinity)?

    Basically, I'm trying to make "Telerik.Samples.Products" module project exactly like Sitefinity's "Generic Content" module, with a COMPLEX form appended and everything else is pretty much the same. But, the client don't want to use "Generic Content" in the admin, must be on its own separate module.

    Please help. Thank you.
    William Chang
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    21 Apr 2010
    Link to this post
    Hi William Chang,

    You could create a module that inherits from GenericContentModule claass. Thus you will have the same functionality and view as Generic Content module. If you want to have something custom you could easily implement the logic in the overridden module.

    Regards,
    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.
  3. William Chang
    William Chang avatar
    12 posts
    Registered:
    05 Apr 2010
    21 Apr 2010
    Link to this post
    After searching the forum, I accidentally found a simpler way of just using the web.config and the "Generic Content" module with a drop-down list by ProviderName. I'm referring to this post:
    http://www.sitefinity.com/support/forums/sitefinity-3-x/developing-with-sitefinity/creating-different-provider-for-generic-content-module.aspx#719694

    But, I have a problem the admin interface can't load the modified templates I used from Generic_Content in Sitefinity_3_7_2096_standard_trial_ExternalTemplates.zip. The path and folder renamed are correct (e.g. Sitefinity\Admin\ControlTemplates\SpecialContent1). Inside my folder, I only added the modified files: "ContentNewView.ascx", "ContentItemsList.ascx", and "ContentEditView.ascx".

    What am I doing wrong?

    Thank you for your help.
    William Chang
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    21 Apr 2010
    Link to this post
    Hello William Chang,

    Please take a look at this post - Mapping to different templates based on provider name

    Regards,
    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.
  5. William Chang
    William Chang avatar
    12 posts
    Registered:
    05 Apr 2010
    21 Apr 2010
    Link to this post
    Thanks!

    Looking good so far, but I'm running through another problem with the "add" element and the "key" attribute. The first half of the article say put the provider name (e.g. "Blogs", mine is "SpecialContent1") in the "key", but I got an error. The second half of the article say about the "key" again with something like "SimpleListTemplatePath|Lists1", but where did they get the value "SimpleListTemplatePath" from? I can't find it for "ContentNewView.ascx", "ContentItemsList.ascx", "ContentEditView.ascx"?

    Here is my Telerik.Sitefinity.Configuration.ControlsConfig.xml:
    <?xml version="1.0" encoding="utf-8"?>
    <controlsConfig>
        <viewMap>
            <!--Provides user interface for displaying a list of content items in the Generic Content module.-->
            <viewSettings hostType="Telerik.Cms.Engine.WebControls.Admin.ContentItemsList`1[[Telerik.Cms.Engine.WebControls.Admin.ContentItemsView, Telerik.Cms.Engine]]">
                <add key="SpecialContent1" layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/SpecialContent1/ContentItemsList.ascx"/>
            </viewSettings>
            <!--Provides user interface for editing a content item in the Generic Content module.-->
            <viewSettings hostType="Telerik.Cms.Engine.WebControls.Admin.ContentItemEdit`1[[Telerik.Cms.Engine.WebControls.Admin.ContentItemsView, Telerik.Cms.Engine]]">
                <add ="SpecialContent1" layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/SpecialContent1/ContentEditView.ascx"/>
            </viewSettings>
            <!--Provides user interface for adding a new content item in the Generic Content module.-->
            <viewSettings hostType="Telerik.Cms.Engine.WebControls.Admin.ContentItemNew`1[[Telerik.Cms.Engine.WebControls.Admin.ContentItemsView, Telerik.Cms.Engine]]">
                <add key="SpecialContent1"layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/SpecialContent1/ContentNewView.ascx"/>
            </viewSettings>
        </viewMap>
    </controlsConfig>

    Thank you,
    William Chang
  6. William Chang
    William Chang avatar
    12 posts
    Registered:
    05 Apr 2010
    21 Apr 2010
    Link to this post
    I think I got it working. The ControlsConfig XML was malformed. I'm still not sure about using the Provider Name (e.g. "SpecialContent1") in the "key" attribute" of the "add" element within each "viewSettings/additionalTemplates", if that is correct?

    Thank you for helping,
    William Chang
  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    22 Apr 2010
    Link to this post
    Hi William Chang,

    The key value should be the name of the provider.

    Greetings,
    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.
Register for webinar
7 posts, 0 answered