Radrotator - how to set source to a picture library?

5 posts, 0 answers
  1. Shilpa
    Shilpa avatar
    2 posts
    Member since:
    Jul 2008

    Posted 30 Jul 2008 Link to this post


    On the home master page, on the top right part, certain images that are stored in a picture library must be rotated. I am using a radRotator for this.

    The control loads properly but the images arent been displayed. The picture library is in one of the subsites... How do I set the path of the datasource for the rotator to this? For testing I tried to set the source as site collection images, but it wasnt picking up from there either.. Please help!

    Following is the code:
         <telerik:RadRotator ID="RadRotator1" runat="server"
          Width="224px" Height="145px" ScrollDuration="500"
          FrameDuration="2000" DataSourceID="Profiles" ItemHeight="145" ItemWidth="224">
          <ItemTemplate>
                                <div class="outerWrapper">
                                    <img src='<%# DataBinder.Eval(Container.DataItem, "Name") %>' alt="Customer Image" />
                                </div>
                            </ItemTemplate>
          </telerik:RadRotator>
          <SharePoint:SPDataSource runat="server" DataSourceMode="List" UseInternalName="true"
           selectcommand="&lt;View&gt;&lt;/View&gt;" id="Profiles">
          </SharePoint:SPDataSource>
  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 31 Jul 2008 Link to this post

    Hello Shilpa,

    I believe that the problem is not in the RadRotator control but in the databinding expression. You can test this by binding the images in a repeater - I assume that they will not be shown there, too. Once you succeed to show them in the repeater control, the same expression should work for the RadRotator, too.

    What I can suggest is to make sure that either the images are in the root directory or change the databinding expression in order to point the right path, e.g:

     <ItemTemplate> 
         <li><asp:Image ImageUrl='<%# Eval("Name", "~/Img/{0}.jpg") %>' ID="smallImage" runat="server" AlternateText="Product image" /></div>  
         </li> 
         </ItemTemplate> 
     



    Kind regards,
    Svetlina
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

  3. Shilpa
    Shilpa avatar
    2 posts
    Member since:
    Jul 2008

    Posted 31 Jul 2008 Link to this post

    Hi Svetlina,

    The code that I have written is something that i tried ... Its not necessarily the right way to do it..

    My question to you is that in MOSS, how do u set the datasource to a radrotator as a picture library in the master page?

    Regards
    Shilpa
  4. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 01 Aug 2008 Link to this post

    Hello Shilpa,

    RadRotator is yet another databound control, and we are not sure about where the problem is. As suggested in our previous answer - please use a regular <asp:Repeater/> to simulate your scenario. Once you are able to successfully add a repeater to your page, bind it to the data source and get it to render its item template on the page, all you need to do is replace the <asp:Repeater/> with a RadRotator, keeping all logic the same.

    In case you are able to achieve your scenario with a Repeater, but encounter any problems switching to RadRotator, please open a support ticket and send us a screenshot of the result, as well as the actual page and codebehind for us to examine.

    Best regards,
    Tervel
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Tom Kaminski
    Tom Kaminski avatar
    7 posts
    Member since:
    Aug 2007

    Posted 05 Nov 2010 Link to this post

    After much frustration I was finally able to get this work, so I wanted to share the actual answer here.  I can't believe I was not able to find a specific working example anywhere!

    Here's what you need (after doing all the basic install stuff first).  Note that I added a Yes/No 'Publish' column to my picture library so this only selects the pictures I checked.  Of course the list ID in the SPDataSource Parameters much match yours. I kept trying to use 'URL Path' for the image but finally figured out it was 'FileRef' that worked.

    <div style="margin-bottom:20px;">
    Photo Library
    <telerik:RadRotator ID="RadRotator1" runat="server" DataSourceID="spdatasource1" Width="400px" Height="150px" ScrollDuration="500" FrameDuration="10000" ItemHeight="150" ItemWidth="400">
        <ItemTemplate>
            <table style="width:100%;">
                <tr>
                    <td style="width:200px;"><img src='<%# Eval("FileRef") %>' style="height:150px;width:200px;" /></td>
                    <td style="width:200px; vertical-align:top; font-size:10pt;padding-left:5px;"><%# Eval("Description") %></td>
                </tr>
            </table>
        </ItemTemplate>
    </telerik:RadRotator>
      
    <SharePoint:SPDataSource runat="server" DataSourceMode="List" UseInternalName="true" selectcommand="<View><Query><OrderBy><FieldRef Name="Modified" Ascending="FALSE"/></OrderBy><Where><Eq><FieldRef Name="Publish"/><Value Type="Text">1</Value></Eq></Where></Query><ViewFields><FieldRef Name="_SourceUrl"/><FieldRef Name="Title"/><FieldRef Name="Description"/><FieldRef Name="Publish"/><FieldRef Name="ID"/><FieldRef Name="FileRef"/><FieldRef Name="FileDirRef"/><FieldRef Name="PermMask"/><FieldRef Name="BaseName"/></ViewFields></View>" id="spdatasource1">
            <SelectParameters>
                <asp:Parameter Name="ListID" DefaultValue="{3CC99460-D8E1-45AF-885A-557C6DCC8157}"/></SelectParameters>
            <DeleteParameters>
                <asp:Parameter Name="ListID" DefaultValue="{3CC99460-D8E1-45AF-885A-557C6DCC8157}"/></DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="ListID" DefaultValue="{3CC99460-D8E1-45AF-885A-557C6DCC8157}"/></UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="ListID" DefaultValue="{3CC99460-D8E1-45AF-885A-557C6DCC8157}"/></InsertParameters>
    </SharePoint:SPDataSource>
    </div>
Back to Top