Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Rotator > Add images to rotator programatically

Not answered Add images to rotator programatically

Feed from this thread
  • Posted on Dec 14, 2011 (permalink)

    I'm trying to follow your example but I don't know what I'm messing up. Essentially, I just want to be able to add images to a rotator so it displays something like a powerpoint. Here's my aspx


    <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
     
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <telerik:RadScriptManager ID="ScriptManager1" runat="server">
            </telerik:RadScriptManager>
            <telerik:RadRotator ID="RadRotator1" runat="server"
                RotatorType="SlideShowButtons" SlideShowAnimation-Type="Fade"
                Width="400" ItemWidth="400" Height="200" ItemHeight="200" CssClass="rotator"
                ScrollDirection="Left,Right">
                <ControlButtons LeftButtonID="prevButton" RightButtonID="nextButton" />
            </telerik:RadRotator>
        </div>
        </form>
    </body>
    </html>




    And here's my c#
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Microsoft.Office.Core;
    using Microsoft.Office.Interop.PowerPoint;
    using Telerik.Web.UI;
    using System.Data;
    using System.Collections;
     
    public partial class _Default : System.Web.UI.Page
    {
        MyFunctions obj = new MyFunctions();
        String webPath = System.Configuration.ConfigurationManager.AppSettings["websitePath"];
     
        protected void Page_Load(object sender, EventArgs e)
        {
     
     
            if (obj.convertPpt("myfile.pptx") == "true")
            {
     
     
                RadRotator rr = RadRotator1;
     
                rr.DataSource = CreateRotatorData();
                rr.DataBind();
                this.Controls.Add(rr);
                 
            }//if obj.convertPpt
            else
            {
                Response.Write("We couldn't convert the power point");
            }//else
     
        }//page_load
     
        private ArrayList CreateRotatorData()
        {
            ArrayList al = new ArrayList();
            al.Add(ResolveUrl(webPath + "powerPointImages\\Slide1.jpg" ));
            al.Add(ResolveUrl(webPath + "powerPointImages\\Slide2.jpg" ));
     
            return al;
        }//CreateRotatorData
     
    }// _Defautl

    Reply

  • Kevin Master avatar

    Posted on Dec 19, 2011 (permalink)

    Hello Web Services,

    The reason why your code doesn't work is because you haven't specified the ItemTemplate used by the RadRotator. The RadRotator is not just used to display images and will not automatically create the image tags for you. If you look at all the demos on the Telerik site, you will see that the ItemTemplate is specified in all of them.

    I hope that helps.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Rotator > Add images to rotator programatically
Related resources for "Add images to rotator programatically"

[  ASP.NET Rotator Features  |  Documentation  |  Demos |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial  ]