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

RadRotator.Datasource binding

7 Answers 225 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
Ivan Queiroz
Top achievements
Rank 1
Ivan Queiroz asked on 09 Dec 2009, 06:01 PM

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

7 Answers, 1 is accepted

Sort by
0
Ivan Queiroz
Top achievements
Rank 1
answered on 14 Dec 2009, 03:47 PM
I haven't heard back from a anyone yet. Am I the only one trying to do this?
0
Accepted
Fiko
Telerik team
answered on 14 Dec 2009, 04:30 PM
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.
0
Ivan Queiroz
Top achievements
Rank 1
answered on 14 Dec 2009, 06:22 PM
Thanks Fiko,

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

Ivan.
0
Carlos Perez
Top achievements
Rank 1
answered on 22 Jul 2010, 03:12 AM
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.
0
Pero
Telerik team
answered on 27 Jul 2010, 01:02 PM
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
0
Carlos Perez
Top achievements
Rank 1
answered on 29 Jul 2010, 03:34 PM
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.
0
Fiko
Telerik team
answered on 03 Aug 2010, 03:19 PM
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
Tags
Rotator
Asked by
Ivan Queiroz
Top achievements
Rank 1
Answers by
Ivan Queiroz
Top achievements
Rank 1
Fiko
Telerik team
Carlos Perez
Top achievements
Rank 1
Pero
Telerik team
Share this question
or