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

Bind to XmlDataSource.Data failure

3 Answers 77 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
Art Kedzierski
Top achievements
Rank 2
Art Kedzierski asked on 22 Jan 2010, 08:36 PM
I'm using a web-service to pull data from a SharePoint list which is then cleaned up and bound to a Rotator. During debug I can see that the XML is clean, and when checking the rendered source I can see that there are the appropriate number of items generated. The dummy text 'Boo!' even rotates twice as expected. However, I cannot seem to bind to the underlying elements such as <%# XPath("title") %>.

Generated XML (sw)
<?xml version="1.0" encoding="utf-16"?> 
<newsfeed xmlns="http://schemas.microsoft.com/sharepoint/soap/"
  <article> 
    <title>Some Text here.</title> 
    <author>Smith, Steve</author> 
    <created>2008-02-04 16:28:43</created> 
    <body>Some Text here.</body> 
  </article> 
  <article> 
    <title>Some Text here.</title> 
    <author>Doe, John</author> 
    <created>2010-01-21 14:10:10</created> 
    <body>Some Text here.</body> 
  </article> 
</newsfeed>



Code behind
// code to retrieve and transform webservice feed above here 
XmlDataSource1.Data = sw.ToString(); 
rr_TacNews.DataBind(); 

ASPX
    <asp:XmlDataSource ID="XmlDataSource1" runat="server"></asp:XmlDataSource> 
    <div id="webpane"
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
        </telerik:RadScriptManager> 
        <telerik:RadRotator ID="rr_TacNews" runat="server" ScrollDirection="Left" FrameDuration="10000" 
            Height="800px" Width="100%" ForeColor="White" DataSourceID="XmlDataSource1"
            <ItemTemplate> 
                <div style="width: 576px; padding: 12px;"
                Boo! 
                    <asp:Label ID="Label1" runat="server" Text='<%# XPath("title") %>'></asp:Label><br /> 
                    <asp:Label ID="Label2" runat="server" Text='<%# XPath("author") %>'></asp:Label><br /> 
                    <asp:Label ID="Label3" runat="server" Text='<%# XPath("created") %>'></asp:Label><br /> 
                    <asp:Label ID="Label4" runat="server" Text='<%# XPath("body") %>'></asp:Label> 
                </div> 
            </ItemTemplate> 
        </telerik:RadRotator> 
 

Any ideas?



3 Answers, 1 is accepted

Sort by
0
Fiko
Telerik team
answered on 27 Jan 2010, 03:55 PM
Hi Art,

You do not see the text because you set the ForeColor="White" property of the control. I suppose that you have a white background color as well and this is the reason why you do not see the text inside the RadRotator control. Could you please change the background color or set a different value to the ForeColor property of RadRotator and the problem will disappear.

In addition, I recommend you to specify the ItemWidth and ItemHeight properties of the RadRotator control. Also, I recommend you to remove the namespace that is used in the XML document or apply one of these approaches in order to able to use the XmlDataSource control:

Please do not hesitate to contact us if you have any additional questions.

Regards,
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
Art Kedzierski
Top achievements
Rank 2
answered on 27 Jan 2010, 04:19 PM
The ForeColor is white because the background color of the wrapping div is dark gray. As I mentioned, when i view the generated source, I see two items as expected, but none of the subtending data items bind.

Generated Source
        <div id="rr_TacNews" class="RadRotator RadRotator_Default" style="color:White;height:800px;width:100%;"
    <!-- 2009.3.1208.35 --><div class="rrRelativeWrapper"
        <div class="rrClipRegion"
            <ul class="rrItemsList"
                <li class="rrItem"><div id="rr_TacNews_i0"
                     
                <div style="width: 576px; padding: 12px;"
                Boo! 
                    <span id="rr_TacNews_i0_Label1"></span><br /> 
                    <span id="rr_TacNews_i0_Label2"></span><br /> 
                    <span id="rr_TacNews_i0_Label3"></span><br /> 
                    <span id="rr_TacNews_i0_Label4"></span> 
                </div> 
             
                </div></li><li class="rrItem"><div id="rr_TacNews_i1"
                     
                <div style="width: 576px; padding: 12px;"
                Boo! 
                    <span id="rr_TacNews_i1_Label1"></span><br /> 
                    <span id="rr_TacNews_i1_Label2"></span><br /> 
                    <span id="rr_TacNews_i1_Label3"></span><br /> 
                    <span id="rr_TacNews_i1_Label4"></span> 
                </div> 
             
                </div></li
            </ul> 
        </div><a class="rrButton rrButtonUp" href="javascript:void(0);">&nbsp;</a><a class="rrButton rrButtonLeft" href="javascript:void(0);">&nbsp;</a><a class="rrButton rrButtonRight" href="javascript:void(0);">&nbsp;</a><a class="rrButton rrButtonDown" href="javascript:void(0);">&nbsp;</a> 
    </div><input id="rr_TacNews_ClientState" name="rr_TacNews_ClientState" type="hidden" /> 
 
    </div> 
</div> 
 

I will attempt your other suggestions.
0
Mike
Top achievements
Rank 1
answered on 27 Jan 2010, 08:15 PM
I would add this to your XmlDataSource tag on your aspx page: 

 

 

XPath="newsfeed/article" 

 

 

Tags
Rotator
Asked by
Art Kedzierski
Top achievements
Rank 2
Answers by
Fiko
Telerik team
Art Kedzierski
Top achievements
Rank 2
Mike
Top achievements
Rank 1
Share this question
or