More in this section

Forums / Developing with Sitefinity / show random pictures from the gallery

show random pictures from the gallery

4 posts, 0 answered
  1. Manoj
    Manoj avatar
    20 posts
    Registered:
    23 Oct 2008
    01 Jun 2009
    Link to this post
    we are using a image gallery option in this we want image show picture randomly and it should be move one by another

    Regards,
    Manoj

  2. Sonya
    Sonya avatar
    231 posts
    Registered:
    24 Sep 2012
    01 Jun 2009
    Link to this post
    Hi Manoj,

    You need to use the RadRotator control - it will rotate images from a given library. For more information, you could examine the online Sitefinity demo - you could find exactly what you need on the Home page of that project: Online Sitefinity Demo
    You could also log into the backend to see what settings are necessary in order to work with that control.

    Do not forget to include the control in the web.config file so that you have access to it in the Toolbox in Edit page mode (RadControls for ASP.Net AJAX)

    Let us know if you need further assistance.

    Best wishes,
    Sonya
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Manoj
    Manoj avatar
    20 posts
    Registered:
    23 Oct 2008
    15 Jun 2009
    Link to this post
    We have do the same , we able to drag the rad rotator on our page but in that rad rotator how we can assign our selected image library.

    is there any option so that we can link particular image with different link.


  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    15 Jun 2009
    Link to this post
    Hello Manoj,

    You need to bind the RadRotator control to your libraries. For instance you can use ObjectDataSource control.

    sample:

    <telerik:RadRotator ID="imagesRotator" runat="server" DataSourceID="odsImages" RotatorType="SlideShow" FrameDuration="5000" WrapFrames="True" ScrollDirection="Up" ItemHeight="300px" ItemWidth="300px" Width="300px" Height="300px">  
     
    <asp:ObjectDataSource ID="odsImages" runat="server"  
        TypeName="Telerik.Cms.Engine.ContentManager"  
        SelectMethod="GetContent"  
        StartRowIndexParameterName="from"  
        MaximumRowsParameterName="max"  
        SortParameterName="sortExp" 
        onobjectcreating="odsImages_ObjectCreating"   
        onselecting="odsImages_Selecting">  
    </asp:ObjectDataSource>  
     

    You can create a view state property in the code behind and specify your library

     protected Guid LibraryId 
        { 
            get 
            { 
                object obj = ViewState["LibraryID"]; 
                if (obj != null
                    return (Guid)obj; 
                return Guid.Empty; 
            } 
            set 
            { 
                ViewState["LibraryID"] = value; 
            } 
        } 
     

    Then you can bind the images.

        protected void odsImages_ObjectCreating(object sender, ObjectDataSourceEventArgs e) 
        { 
            _libraryManager = new Telerik.Libraries.LibraryManager(); 
            ContentManager man = new ContentManager("Libraries"); 
            e.ObjectInstance = man; 
        } 
     
     
     
        protected void odsImages_Selecting(object sender, System.Web.UI.WebControls.ObjectDataSourceSelectingEventArgs e) 
        { 
            string sortExpr = "Name ASC"
            System.Guid[] myArray = { LibraryId }; 
            e.InputParameters.Add("from", 0); 
            e.InputParameters.Add("max", ImageMax); 
            e.InputParameters.Add("parentIDs", myArray); 
            e.Arguments.SortExpression = sortExpr; 
        } 

    If your approach is different, let us know.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
4 posts, 0 answered