Try Now
More in this section

Forums / Developing with Sitefinity / Beginner Question on Creating RadRotator

Beginner Question on Creating RadRotator

4 posts, 0 answered
  1. Steven
    Steven avatar
    2 posts
    28 Oct 2010
    24 Apr 2013
    Link to this post
    I have begun developing on Sitefinity for an update to my company website.  I am learning at the moment and am attempting to create a RadRotator based control for our home page.  I have created a RadRotator using an XML file for a data source to learn that control.  I have also created a custom module: TestFrontPageItem with 'Title', Summary, and ImageSource as fields.  I am stumped on how to pass the fields from my module to the RadRotator control. 

    Following a tutorial in the Getting started, I have created a Test.ascx user control and I was able to get data to show up on my page by copying the code generated in the custom module:
    <telerik:radgrid id="Grid" runat="server" autogeneratecolumns="True">   
                    <telerik:gridboundcolumn datafield="Title" headertext="Title"></telerik:gridboundcolumn>               

    this works through the hookup in the c# file:
    protected void Page_Load(object sender, EventArgs e)
               var myCollection = GetDataItems();
               // Binds the collection of Person items to the RadGrid
               Grid.DataSource = myCollection;
           public IQueryable<DynamicContent> GetDataItems()
               DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
               Type testfrontpageitemType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.TestFrontPageItem.Testfrontpageitem");
               // Fetch a collection of "live" and "visible" testfrontpageitem items.
               var myCollection = dynamicModuleManager.GetDataItems(testfrontpageitemType)
                   .Where(i => i.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live && i.Visible == true);
               return myCollection;


    Using that same logic I have hooked up the myCollection to the RadRotator:

                RadRotator1.DataSource = myCollection;

    At that point I don't know how to get the fields from the Module to show up in the Rotator:
    <telerik:RadRotator ID="RadRotator1" runat="server" RotatorType="Carousel">
                <asp:Label runat="server" ID="Summary"  text="<%# Summary %>"/>
                <asp:Label runat="server" ID="Title" Text="<%# Title %>"></asp:Label>
                <asp:Image runat="server" ID="ImageURL" ImageUrl="<%#  %>" "/>

    I'm sure I need to add something in the <%# %> to declare the source of the fields, but I am not sure of the syntax to get it from the Sitefinity Module.

  2. Stacey
    Stacey avatar
    291 posts
    18 Oct 2012
    24 Apr 2013 in reply to Steven
    Link to this post
    The correct syntax on the binding statements.

    here is what it should look like:
    <%# Eval("Title") %>

    so in full - Text='<%# Eval("Title") %>'  Note the use of single quotes wrapping the full statement.
  3. Steven
    Steven avatar
    2 posts
    28 Oct 2010
    25 Apr 2013 in reply to Stacey
    Link to this post
    thank you for your help -- this did it -- I hadn't found the Eval() in any examples that I have looked at up to now. 
  4. Pavel Benov
    Pavel Benov avatar
    341 posts
    14 Mar 2016
    29 Apr 2013
    Link to this post

    I would advise to take a look at our News Rotator control in the SDK which you can also try implementing yourself by following the instructions in the Documentation. You can also go through the RadRotator demos available here.

    Pavel Benov
    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