Beginner Question on Creating RadRotator

Posted by Community Admin on 04-Aug-2018 20:48

Beginner Question on Creating RadRotator

All Replies

Posted by Community Admin on 24-Apr-2013 00:00

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.

Posted by Community Admin on 24-Apr-2013 00:00

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.

Posted by Community Admin on 25-Apr-2013 00:00

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. 

Posted by Community Admin on 29-Apr-2013 00:00


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

This thread is closed