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

Forums / Developing with Sitefinity / Rotator showing News as a Ticker

Rotator showing News as a Ticker

22 posts, 0 answered
  1. obirah
    obirah avatar
    7 posts
    Registered:
    30 Jan 2007
    01 Oct 2007
    Link to this post
    Hell everyone,

    not long ago we started using Sitefinity with the idea to see how much can a "non-developer" achieve with the platform.

    Implementation of basic stuff like, menus, general content, pages, news etc. is going pretty well, but as we progress, there are ideas popping up, which we don't know how to realize.

    Is there a possibility to make the Rotator control take only the titles of News items created in the Module section and rotate them ala...hm... let's say Apple Computer web page?

    At this time we made it with the Ticker control, but only with the TickerLine property for demo purposes.

    Thank you in advance,

    Milen Golchev
    Golchev & Komm
  2. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    01 Oct 2007
    Link to this post
    Hi Milen,

    You could achieve the required functionality by implementing your own User Control wrapping RadRotator control. The Rotator should be bound to a data source that gets all existing News. In the attachment you could find a very simple implementation of this.

    Hope this helps.

    Greetings,
    Pepi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Jules
    Jules avatar
    65 posts
    Registered:
    20 Jul 2005
    05 Oct 2007
    Link to this post
    I've created a version of this, but I'm getting the following error message when I add the control to a page.

    "RadRotator: You have not specified a template OR there is problem with your databinding expression (possibly you haven't specified a datasource or content file)."

    Any clues?


  4. Slavo
    Slavo avatar
    295 posts
    Registered:
    24 Sep 2012
    08 Oct 2007
    Link to this post
    Hi Julia Essex,

    The error you are talking about occurs only when you first drop the control on a page. The reason for it is that the code for binding the Rotator to a datasource only executes when the page is loaded before any postbacks. Once you publish the page, everything will work fine both in design time and on the live site.

    Kind regards,
    Slavo
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Jules
    Jules avatar
    65 posts
    Registered:
    20 Jul 2005
    08 Oct 2007
    Link to this post
    I have the RadRotator in my template, and I'm finding this happens each time I create a page. Is there any plan to fix this, or must I instruct the site editors to ignore the error?

    Juia
  6. Slavo
    Slavo avatar
    295 posts
    Registered:
    24 Sep 2012
    09 Oct 2007
    Link to this post
    Hi Julia,

    I've attached an updated version of the control which solves the problem. Hope this helps.

    Sincerely yours,
    Slavo
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  7. obirah
    obirah avatar
    7 posts
    Registered:
    30 Jan 2007
    09 Oct 2007
    Link to this post
    Hi Slavo,

    thank you for the updated version. It works just fine on my project. I do have another problem though.

    My news titles break the line too soon, I do apply a css style that gives the div width of 650 pixels but nothing happens. What am I doing wrong? Where can I fix this property?

    Here is a link - the problem is seen just beneath the main teaser pictures in the black "Aktuell" bar:

    http://golchevkomm.dyndns.org/St%20Antonius%20Krankenhaus/home.aspx



    Thank you in advance!

    Milen Golchev

    Golchev & Komm
  8. Slavo
    Slavo avatar
    295 posts
    Registered:
    24 Sep 2012
    09 Oct 2007
    Link to this post
    Hi Milen,

    The reason for the problem is that RadRotator has a default width and height if the corresponding properties are not set. Now, in the attachment, I exposed RadRotator as a single property of the user control, and you can edit it through the Sitefinity interface. Just go to the page, select Edit for the NewsRotator user control, and then again Edit for the Rotator property. Try setting the width to 100% (in the Layout section) and this should solve your problem.

    Regards,
    Slavo
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  9. Jacques
    Jacques avatar
    427 posts
    Registered:
    28 Jun 2007
    09 Nov 2009
    Link to this post
    Hi Pepi,

    What do you mean by creating your own User Control wrapping RadRotator control. It's not the control so much, but I'm not quite sure how to use this user control that you've created? How do I apply it?

    Thanks,
    Jacques
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    09 Nov 2009
    Link to this post
    Hi J.Hov,

    What do you mean by creating your own User Control wrapping RadRotator control. It's not the control so much, but I'm not quite sure how to use this user control that you've created? How do I apply it?

    I am not sure whether you have check the attached code. If you open the zip you will see that it contains a user control. In the control template there is RadRotator control declared. In the code behind there are two properties for setting provider and initializing NewsManager. Then the RadRotator is bound to list of content items.
    This is a user control and it can be uploaded through Sitefinity's UI or registered under <toolboxControls> section of your web.config file.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  11. Jacques
    Jacques avatar
    427 posts
    Registered:
    28 Jun 2007
    09 Nov 2009
    Link to this post
    Hi Ivan,

    Ok I think I get Telerik/Sitefinity's terminology confused half the time. 

    So when you guys refer to creating wrapper user controls, you're actually referring to creating a user control the makes use of some Sitefinity built-in functionality. Is that correct? 

    Then you get control designers... ? This almost seems to work on a similar premise as with wrappers, but then not. 
    We're actually going to be making use of both of these scenarios in our current Sitefinity project so it'll be good to get this clear. 

    I'm looking for links on your site that clearly explains these concepts. Can you point me in the right direction? 

    Thanks,
    Jacques 
  12. Jacques
    Jacques avatar
    427 posts
    Registered:
    28 Jun 2007
    09 Nov 2009
    Link to this post
    Also,

    we're trying the Rotator style for the news view where we're binding using your examples as follows: 

    (e.Item.FindControl("NewsTitle"as Label).Text = ((IContent)e.Item.DataItem).GetMetaData("Title").ToString(); 
    (e.Item.FindControl("NewsThumbnail"as Image).ImageUrl = ((IContent)e.Item.DataItem).ThumbnailUrl; 

    Actually the first line is the example from your side, but we're wanting to add the image. But the thumbnail produces the following src: /09-11-09/My_article_sample.tmb.ashx
    The image itself doesn't show. 

    Should we be adding anything to this code for it to point to the thumbnail that is stored with the news item? 

    Thanks,
    Jacques
  13. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    09 Nov 2009
    Link to this post
    Hello J.Hov,

    Here is a sample code that applies to Sitefinity 3.7 implementation


    <telerik:RadRotator ID="rotator" runat="server" Width="300" Height="300" RotatorType="AutomaticAdvance" ScrollDirection="Right">
    <ItemTemplate>
    <asp:Literal ID="NewsTitle1" runat="server" />
    <asp:Image ID="CustomerImage" runat="server" />
    </ItemTemplate>
     
    </telerik:RadRotator>


           NewsManager nman = new NewsManager("News");
           var items = nman.Content.GetContent();
           rotator.DataSource = items;
           rotator.ItemDataBound += new Telerik.Web.UI.RadRotatorEventHandler(rotator_ItemDataBound);
           rotator.DataBind();
          
         ....
            ....
                ....
     
    void rotator_ItemDataBound(object sender, Telerik.Web.UI.RadRotatorEventArgs e)
       {
           IContent cnt = e.Item.DataItem as IContent;
           string title = (string)cnt.GetMetaData("Title");
           string thumb = (string)cnt.GetMetaData("Thumbnail");
           Literal lit = e.Item.FindControl("NewsTitle1") as Literal;
           Image img = e.Item.FindControl("CustomerImage") as Image;
           if (img != null && lit !=null)
           {
               lit.Text = title;
               thumb = GetUrl(thumb, true);
               img.ImageUrl = thumb;
           }
            
     
       }
    // helper method for resolving dynamic urls.
    private string GetUrl(string value, bool resolveAsAbsoluteUrl)
       {
           if (value != null && value.StartsWith("~/"))
               return this.ResolveUrl(value);
           if (value != null && value.StartsWith("["))
           {
               int idx = value.IndexOf("]");
               string provider = value.Substring(1, idx - 1);
               string strId = value.Substring(idx + 1);
               Guid id = new Guid(strId);
               if (ContentManager.Providers.ContainsKey(provider))
               {
                   IContent cnt = ContentManager.Providers[provider].GetContent(id);
                   if (cnt != null)
                       return VirtualPathUtility.ToAbsolute(cnt.UrlWithExtension, this.Context.Request.ApplicationPath);
               }
               else
               {
                   SiteMapNode node = SiteMap.Provider.FindSiteMapNodeFromKey(id.ToString());
                   if (node != null)
                       return this.ResolveUrl(node.Url);
               }
               return String.Concat("Item not found: [", value, "]", id);
           }
           return value.ToString();
       }

    In your case the images path is not competed and the path is not fully resolved. You can fix this by adding the needed path as a prefix to ThumbnailUrl

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  14. Jacques
    Jacques avatar
    427 posts
    Registered:
    28 Jun 2007
    10 Nov 2009
    Link to this post
    Hi Ivan,

    Thanks that worked. BTW, it worked in SF3.6 as well. 

    One extra thought on this. I was going through the help files on the RadRotator and what I couldn't quite get a clear picture on is where Ajax fits in? It seems to load all of the 'slides' on the first call... no dynamic Ajax calls back to the server to extract more details. Is this correct and if so, what's Ajax about this control? 

    Regards,
    Jacques
  15. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    10 Nov 2009
    Link to this post
    Hello J.Hov,

    All items are bound on page load. The implementation of the control will be extended in one of the future releases of RadControls for ASP.NET AJAX. As for the AJAX I suggest that you should take a look at the API description and see the client side methods and properties.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  16. Ahmed Salman
    Ahmed Salman avatar
    31 posts
    Registered:
    13 Apr 2010
    26 Apr 2010
    Link to this post
    Dear sir ,

       When i try to use the example in my localhost it gives me the below error when i try to add it to my page in sitfinity

    Error Message: Could not load file or assembly 'RadRotator.Net2' or one of its dependencies. The system cannot find the file specified.


    please review the attached file.
  17. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    26 Apr 2010
    Link to this post
    Hello Ahmed Salman,

    Please use reference to Telerik.Web.UI.dll. The sample uses the old RadControls for ASP.NET AJAX.

    Sincerely yours,
    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.
  18. Mehdi Aliakbari
    Mehdi Aliakbari avatar
    7 posts
    Registered:
    25 May 2010
    14 Jun 2010
    Link to this post
    Hello there,
    I'm extending NewsView control and define new presentation mode called Scrolling List. Also I define new template and use the NewsRotator you've provided in this article and add it to the NewsViewControlDesigner.aspx like this:

    ...
    <sfDesign:PresentationMode ID="ScrollMode" runat="server"
        ModeTitle="Scrolling List"
        ModeSettingsId="ModeSettings2"
        MasterTemplatePath = "~/Sitefinity/ControlTemplates/News/ScrollPageMaster.ascx"
    ...

    Everything work fine and I've successfully define new presentation mode.

    But now, I want to force the NewsRotator to load only items in an specific category (or categories) that I have selected through a CheckBoxList in designer.

    How should I do this?

    Thanks a lot
  19. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    14 Jun 2010
    Link to this post
    Hello Mehdi Aliakbari,

    This can be achieved by setting a FilterExpression to the NewsView control, if you are getting the rotator items from the NewsView. In this case the expression should be "Category = BreakingNews". 
    If you are getting the list of items in another way, through the API for example, then you should use the MetaSearchInfo approach, described here - http://www.sitefinity.com/devnet/forums/sitefinity-3-x/developing-with-sitefinity/get-all-generic-content-items-by-category-id.aspx

    I hope this helps.

    All the best,
    Georgi
    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.
  20. Mehdi Aliakbari
    Mehdi Aliakbari avatar
    7 posts
    Registered:
    25 May 2010
    14 Jun 2010
    Link to this post
    Hi Georgi,
    Cheers! This is what I'm  looking for. I swear I've search this forum for "by Category ID" keyword and didn't find the article you've point to. Maybe some problems in the search mechanism or I've been blinded!
    BTW, many thanks to you for this quick and great reply.

    Best Regards,
    Mehdi
     
  21. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    15 Jun 2010
    Link to this post
    Hello Mehdi Aliakbari,

    No worries. Good luck with the project!

    Best wishes,
    Georgi
    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.
  22. Mehdi Aliakbari
    Mehdi Aliakbari avatar
    7 posts
    Registered:
    25 May 2010
    15 Jun 2010
    Link to this post
    Hi every body,
    I came back with another problem. I really want to extend this News Rotator and as I'm going forward, I'm facing bigger issues.
    I want this NewsRotator displays its items in the way standard NewsView does. In fact I want the NewsRotator shows only those parts of News Items I've selected in design view.
    Shall I build it from scratch or is there a better way to do? In fact I need a solution to be able to use the Telerik Repeater_ItemDataBound source code you've used in standard NewsView.
    Is there anychance for me to do it?

    Thanks,
    Mehdi
Register for webinar
22 posts, 0 answered