This is a migrated thread and some comments may be shown as answers.

Databinding Rotator from codebehind

1 Answer 106 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
apb
Top achievements
Rank 1
apb asked on 24 Mar 2009, 05:39 PM
Hi,

I'm basically using the RSS feed example from your demos. The only change I have to make is to set the DataSource in code since I'm putting it in a RadDock and the stupid XmlDataSource crashes on Page_Init if there is no DataFile set (which isn't known until Page_Load).

Everything works fine if I do this decalritively, but when setting the DataSource in code as below, the Rotator never loads any data and doesn't start rotating.

Any ideas what I am doing wrong?

The code-behind:
XmlDataSource xds = new XmlDataSource();
xds.DataFile = "http://blogs.telerik.com/Blogs.rss"; 
RadRotator1.DataSource = xds;
RadRotator1.DataBind();


The mark-up:

    <telerik:RadRotator ID="RadRotator1"
        RotatorType="AutomaticAdvance"
        AutoAdvance="True"
        Loop="True"
        ScrollDirection="Up"
        ScrollDuration="2000"
        FrameDuration="0"
        Width="360" Height="172"
        InitialItemIndex="-1"
        runat="server">
        <ItemTemplate>
            <div style="width: 360px; height: 42px; padding: 10px 10px 10px 10px; ">
                <strong><a target="_blank" href='<%# XPath("link") %>'>
                    <%# System.Web.HttpUtility.HtmlEncode(XPath("title").ToString())%>
                </a></strong>
                <br />
                <%# XPath("pubDate") %>
            </div>
        </ItemTemplate>
    </telerik:RadRotator>

-Al

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
apb
Top achievements
Rank 1
answered on 24 Mar 2009, 06:08 PM
Figured it out. Was missing:

xds.XPath = "rss/channel/item";

Tags
Rotator
Asked by
apb
Top achievements
Rank 1
Answers by
apb
Top achievements
Rank 1
Share this question
or