Databinding Rotator from codebehind

2 posts, 0 answers
  1. apb
    apb avatar
    46 posts
    Member since:
    Nov 2008

    Posted 24 Mar 2009 Link to this post

    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

     

     

     

     

  2. apb
    apb avatar
    46 posts
    Member since:
    Nov 2008

    Posted 24 Mar 2009 Link to this post

    Figured it out. Was missing:

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

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top