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

Forums / Designing with Sitefinity / Using the rad rotator in sitefinity

Using the rad rotator in sitefinity

6 posts, 0 answered
  1. Jome Akpoduado
    Jome Akpoduado avatar
    16 posts
    Registered:
    07 Jan 2010
    11 Feb 2010
    Link to this post
    Hi,
    I'm really stumped as to how to use the rad rotator to display images in a library in sitefinity. I tried looking at the articles by Josh Morales, http://www.selarom.net/blog/2008-08-29/ajax_news_rotator_in_sitefinity_part_1.aspx
    and I also tried downloading the rotator control developed by Jon.
    However, when I point the rotator to my Image library, all I see on the control is the text "image gallery".

    I'm guessing I am doing something wrong because there are comments that it worked perfectly. Is there a difference between a Sitefinity Gallery and Image Library?
    Also, if I need to use a Radrotator control out of the box, how do I get it to point to my Image library (I'm sorry, but the article by Josh was just too complex for me (for now). Is there an easier way to do this?)
    Thanks.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    11 Feb 2010
    Link to this post
    Hello Jome Akpoduado,

    Below is a basic sample of RadRotator that gets all items from a library

    <telerik:RadRotator ID="RadRotator1" runat="server"
    RotatorType="AutomaticAdvance"  BorderWidth="4px"
    Width="100px"
    Height="100px"
    ScrollDirection="Down" >
       <ItemTemplate>
     <asp:Image runat="server" ID="image1" />
       </ItemTemplate>
    </telerik:RadRotator>

        var manager = new LibraryManager("Libraries");
        IList list = manager.GetImages(0, 100, string.Empty, parentIDs);
     
     
        RadRotator1.DataSource = list;
        RadRotator1.ItemDataBound += new RadRotatorEventHandler(RadRotator1_ItemDataBound);
        RadRotator1.DataBind();
     
     
    void RadRotator1_ItemDataBound(object sender, RadRotatorEventArgs e)
    {
     
        System.Web.UI.WebControls.Image img = e.Item.FindControl("image1") as System.Web.UI.WebControls.Image;
       IContent cnt = e.Item.DataItem as IContent;
       img.ImageUrl = cnt.UrlWithExtension;
    }


    All the best,
    Ivan Dimitrov
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  3. Jome Akpoduado
    Jome Akpoduado avatar
    16 posts
    Registered:
    07 Jan 2010
    11 Feb 2010
    Link to this post
    Hello,
    Thanks for the code to make the Radrotator work. However, the code seems to complain about parentIDs saying it "does not exist in current context". I can't find any definition for parentIDs in line 2 of the code behind.
    IList list = manager.GetImages(0, 100, string.Empty, parentIDs);
    Where does it come from?
    Thanks.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    11 Feb 2010
    Link to this post
    Hi Jome Akpoduado,

    parentIDs is an array of ILibrary IDs from where you get the images you want to route.

    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. Jome Akpoduado
    Jome Akpoduado avatar
    16 posts
    Registered:
    07 Jan 2010
    11 Feb 2010
    Link to this post
    Hi Ivan.
    Thanks for the explanation but I dont see where in the code where this array is created. When I pasted the code into a web control, it keeps complaining about that fact that the variable is not defined. Will this be created within the context of the Cms? Sorry if the answer is obvious... still trying to get to grips with all this info.
    Thanks.
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    11 Feb 2010
    Link to this post
    Hi Jome Akpoduado,

    Please take a look at Developers manual. Pay attention to Get the number of image files in a given library section.

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