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

Forums / General Discussions / Rotator with customizeable template

Rotator with customizeable template

4 posts, 0 answered
  1. Kevin
    Kevin avatar
    4 posts
    Registered:
    30 Jul 2012
    30 Jan 2012
    Link to this post
    Hi all.  I'm trying to build a Rotator control that is very similar to the built in List Control.  The only difference is that it would use the ASP.NET Rotator control to scroll through the items in the list instead of showing them all at once.

    I know there is a News Rotator sample with the SDK that gets me most of the way there.  My real question is how to build the control such that the end user can write custom templates using the Sitefinity backend, just like you can do with the List Control.

    Can someone point me in the right direction?  
  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    28 Aug 2017
    01 Feb 2012
    Link to this post
    Hello Kevin,

     If we tkae the News module, for example, when creating the News widget designer which inherits from ContentViewDesignerBase, we register the views in the AddViews() method, where the ListView is of type ListSettingsDesignerView and the DetailsView of type SingleItemSettingsDesignerView. For example:

    var listSettings = new ListSettingsDesignerView();
               listSettings.SortItemsText = Res.Get<NewsResources>().SortNews;
               listSettings.DesignedMasterViewType = typeof(MasterListView).FullName;
      
               var singleItemSettings = new SingleItemSettingsDesignerView();
               singleItemSettings.DesignedDetailViewType = typeof(DetailsSimpleView).FullName;
               views.Add(contentSelectorsSettings.ViewName, contentSelectorsSettings);
               views.Add(listSettings.ViewName, listSettings);
               views.Add(singleItemSettings.ViewName, singleItemSettings);

    Both views implement the interface for selecting and editing control templates.

    Upon initialization of the module we use the TemplatableControl facade of our Fluent API to register support for editable templates for the two views:
    public override void Initialize(ModuleSettings settings)
           {
               base.Initialize(settings);
      
               App.WorkWith()
                  .Module(NewsModule.ModuleName)
                  .Initialize()
                       .Configuration<NewsConfig>()
                       .Localization<NewsResources>()
                       .SitemapFilter<NewsNodeFilter>()
                       .TemplatableControl<MasterListView, NewsItem>()
                       .TemplatableControl<DetailsSimpleView, NewsItem>();
           }
    A more detailed example can be found in our Sitefinity SDK - the Products catalog sample, whose widget follows the above steps as well. I hope you find the above information useful. Please do not hesitate to let us know is you need some additional information or have any further questions, we'll be glad to help.

    Greetings,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Kevin
    Kevin avatar
    4 posts
    Registered:
    30 Jul 2012
    03 Feb 2012
    Link to this post
    Boyan,

    you lost me pretty quick on that one.  A few questions just to help frame your answer...

    -Where can I find the code you are referring to for the News widget designer?  I don't see any sample of this in the SDK.

    -You said in your answer:  "Upon initialization of the module we use the TemplatableControl facade of our Fluent API to register support for editable templates for the two views".  In this case, I am not building a custom module.  I am just using the List module that already exists in Sitefinity... so I'm not really sure where or why I would be adding this code?

    If it helps, this is what I've done so far:
    -I created a new widget called ListRotator that inherits from SimpleView.  
    -I created a ascx template in the project, and return this in the overriden LayoutTemplateName property in the ListRotator widget.

    What specifically should I do from here?  I don't really understand what the ContentViewDesignerBase is, or why I am registering Views in the AddViews method of it. I also don't understand where a custom module comes into play.


  4. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    28 Aug 2017
    08 Feb 2012
    Link to this post
    Hello,

    Thank you for the additional clarification. In Sitefinity only ContentView based widgets support the TemplateEditor functionality. You can check the related implementation in our ProductsCatalog sample from our
    Sitefinity SDK.

    Regards,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
4 posts, 0 answered