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

Problem with Xml As Data Sources for the RadRotator

2 Answers 77 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
Praneetha Vegasina
Top achievements
Rank 1
Praneetha Vegasina asked on 19 Nov 2009, 11:41 PM
Hi ,

I am new to telerik , Here the code from where i used Xml as Datasource for the Rotator, It bind the Images to rotator but those are not rotating the images are static...........

User Control Page

<%

@ Control Language="C#" AutoEventWireup="true" CodeFile="rotator.ascx.cs" Inherits="layout_controls_rotator" %>

 

<%

@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

 

<

 

telerik:RadScriptManager ID="RadScriptManager1" runat="server">

 

</

 

telerik:RadScriptManager>

 

 

<telerik:RadRotator ID="RadRotator1" Width="328px" Height="120px" ScrollDirection="Up" ScrollDuration="600" FrameDuration="6000" ItemHeight="118" ItemWidth="108" DataSourceID="XmlDataSource1" runat ="server">

 

 

<ItemTemplate>

 

 

<img src='<%# XPath("Link")%>' alt = '<%# XPath("title")%>'/>

 

 

</ItemTemplate>

 

 

</telerik:RadRotator>

 

<

 

asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/Rotator.xml"></asp:XmlDataSource>



ASPX page

 

<%

@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="layout_controls_Test" %>

 

<%

@ Register Src="rotator.ascx" TagName="rotator" TagPrefix="uc1" %>

 

<!

 

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<

 

html xmlns="http://www.w3.org/1999/xhtml" >

 

<

 

head runat="server">

 

 

<title>Rotator</title>

 

</

 

head>

 

<

 

body>

 

 

<form id="form1" runat="server">

 

 

&nbsp;

 

 

<uc1:rotator ID="Rotator1" runat="server" />

 

 

 

</form>

 

</

 

body>

 

</

 

html>

XML File

 


<?

 

xml version="1.0" encoding="utf-8" ?>

 

<

 

RoatatorItems>

 

<

 

item>

 

<

 

title>This is a test 1</title>

 

<

 

Link>C:\Documents and Settings\My Documents\My Pictures\Office1.jpg</Link>

 

</

 

item>

 

<

 

item>

 

<

 

title>This is a test 2</title>

 

<

 

Link>C:\Documents and Settings\My Documents\My Pictures\Office2.jpg</Link>

 

</

 

item>

 

<

 

item>

 

<

 

title>This is a test 3</title>

 

<

 

Link>C:\Documents and Settings\My Documents\My Pictures\Office3.jpg</Link>

 

</

 

item>

 

</

 

RoatatorItems>

 


2 Answers, 1 is accepted

Sort by
0
Fiko
Telerik team
answered on 23 Nov 2009, 09:50 AM
Hi Praneetha,

The behavior that you experience is the expected one. In your case you need to set the size properties of the RadRotator control according to the size of the items in the ItemTemplate. More details about the configuration of the control can be found in this forum thread.
Additionally, I see that you use physical paths (C:\Path). Please note that this approach will not work with any images declared on your page. You need to set a valid virtual path to the images or an absolute path instead.

I hope this helps.

Best wishes,
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
Praneetha Vegasina
Top achievements
Rank 1
answered on 23 Nov 2009, 04:29 PM
Thank you for the information , I got it.
Tags
Rotator
Asked by
Praneetha Vegasina
Top achievements
Rank 1
Answers by
Fiko
Telerik team
Praneetha Vegasina
Top achievements
Rank 1
Share this question
or