RadRotator.Datasource binding

8 posts, 1 answers
  1. Ivan Queiroz
    Ivan Queiroz avatar
    31 posts
    Member since:
    Oct 2009

    Posted 09 Dec 2009 Link to this post


    I am trying to bind a rotator control to an xml document (type=System.Xml.XmlDocument) returned by a method using the rotator’s datasource property:

    RadRotator1.DataSource = object.GetXML()
    RadRotator1.DataBind()



    This is xml returned by the above method:

    <Participants>
        <Participant>
            <FullName>John Smith</FullName>
            <PayAmount>4611.00</PayAmount>
        </Participant>
    </Participants>


    And this is the rotator:

                    <telerik:RadRotator ID="RadRotator1" runat="server" RotatorType="AutomaticAdvance" FrameDuration="4000" ScrollDirection="Down" ScrollDuration="500" Height="120px" Width="300px">
                        <ItemTemplate>
                            <div>
                                <div><%# XPath("FullName") %></div>
                                <div><%# XPath("PayAmount") %></div>
                            </div>
                        </ItemTemplate>
                    </telerik:RadRotator>


    The code runs fine, but nothing displays on the page. What am I doing wrong?

    Thanks for your help.

    Ivan
  2. Ivan Queiroz
    Ivan Queiroz avatar
    31 posts
    Member since:
    Oct 2009

    Posted 14 Dec 2009 Link to this post

    I haven't heard back from a anyone yet. Am I the only one trying to do this?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 14 Dec 2009 Link to this post

    Hi Ivan,

    The RadRotator control uses the standard DataBind mechanism and the problem that you experience is not directly related to RadRotator control. This mean that you will experience the same problem using a standard asp:Repeater (for example) as well. For your convenience, however, I have implemented the solution in a demo and attached it to the thread.

    I hope this helps.

    Sincerely yours,
    Fiko
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Ivan Queiroz
    Ivan Queiroz avatar
    31 posts
    Member since:
    Oct 2009

    Posted 14 Dec 2009 Link to this post

    Thanks Fiko,

    This is pretty simple! I don't know why I didn't think of it ;-) !!

    Ivan.
  6. Carlos Perez
    Carlos Perez avatar
    2 posts
    Member since:
    May 2010

    Posted 21 Jul 2010 Link to this post

    Hi and thx in avance, in the example before where can i put an hyperlink for each item

    like

    <Participants>
     <Participant>
      <FullName>John Smith</FullName>
      <PayAmount>4611.00</PayAmount>

                          < hyperlink  ..... >

     </Participant>
    </Participants>

    I adapted that example for a news rotator, so i want to redirect each news item to a especific page.

    thx again

    Carlos.
  7. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 27 Jul 2010 Link to this post

    Hi Carlos,

    As long as the new (<HyperLink>) node is a child to the <Participant/> node, there is no difference where it will be placed. I modified the XML file in the following way:

    <Participant>
        <FullName>John Smith</FullName>
        <PayAmount>4611.00</PayAmount>
        <HyperLink>http://www.google.com/search?q=John<;/HyperLink>
    </Participant>

    And here is the modified source code of the project:
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <head id="Head1" runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <div>
            <telerik:RadRotator ID="RadRotator1" runat="server" RotatorType="AutomaticAdvance"
                FrameDuration="4000" ScrollDirection="Down" ScrollDuration="500" Height="120px"
                ItemHeight="120" Width="300px" ItemWidth="300">
                <ItemTemplate>
                    <div>
                        <div>
                            <a href='<%# XPath("HyperLink") %>'>
                                <%# XPath("FullName") %></a></div>
                        <div>
                            <%# XPath("PayAmount") %></div>
                    </div>
                </ItemTemplate>
            </telerik:RadRotator>
        </div>
        </form>
    </body>
    </html>


    Kind regards,
    Pero
    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
  8. Carlos Perez
    Carlos Perez avatar
    2 posts
    Member since:
    May 2010

    Posted 29 Jul 2010 Link to this post

    Thx very much Pero, one more question pls, if each item (news in my case) have an id like 

    <news>
         <id>notice1<id> 
        ....
         <id>notice2<id> 
    <news>

    how could i pass that "id" to the child page which porpouse is: shows the enterely news of the selected item, how can i retrieve that "id" in the child page using C#, only i need that value like a "parameter variable", using that i could search the enterely news in another xml file.

    Thx very much
    Best Regards
    Carlos.
  9. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 03 Aug 2010 Link to this post

    Hi Carlos,

    I am not quite sure that I understood your scenario. Could you please implement it without RadRotator control (using an asp:Repeater control for example), open a new support ticket and send it to me? I will rework it in order to use RadRotator control and send it back as soon as possible.

    Kind regards,
    Fiko
    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017