adding a new feature to the Admin file

Last post 07-01-2009 3:36 PM by RaeKC. 4 replies.

Sort Posts:

  • adding a new feature to the Admin file

    06-28-2009, 4:12 PM
    • Member
      55 point Member
    • RaeKC
    • Member since 11-28-2008, 5:52 PM
    • Posts 338

    Hello:
    I have the script below that I'm using for a slide show on a page in a web built based on the Beerhouse project. It would be neat, if I could load the photos by logging in as Admin and add them to the slideshow  from the Admin menu.

    I was wondering if there were any existing samples for that? Or if not, any help to add that feature to the Admin folder would be greatly appreciated!


    =========== code i'm using for slideshow ===============


    <script runat="Server" type="text/C#">
            [System.Web.Services.WebMethod]
            [System.Web.Script.Services.ScriptMethod]
            public static AjaxControlToolkit.Slide[] GetSlides()
            {
                AjaxControlToolkit.Slide[] slides = new AjaxControlToolkit.Slide[8];

                slides[0] = new AjaxControlToolkit.Slide("images/GB.jpg.jpg", "The Old House", "GB");
                slides[1] = new AjaxControlToolkit.Slide("images/Colors 002.jpg", "The Old House", "Front View");
                slides[2] = new AjaxControlToolkit.Slide("images/Colors 028.jpg", "The Old House", "Side View");
                slides[3] = new AjaxControlToolkit.Slide("images/Colors 029.jpg", "The Old House", "Our Workers");
                slides[4] = new AjaxControlToolkit.Slide("images/Colors 030.jpg", "The Old House", "Our equipment");
                slides[5] = new AjaxControlToolkit.Slide("images/FinColors 001.jpg", "The Old Baker House", "Work on the DeBergh House");
                slides[6] = new AjaxControlToolkit.Slide("images/FinColors 002.jpg", "The Old House", "House2");
                slides[7] = new AjaxControlToolkit.Slide("images/FinColors 009.jpg", "The Old House", "Front View");

              
              return(slides);
            }
        </script>

                &nbsp; &nbsp;<br />
                <br />
                
                <asp:Image ID="Image1" runat="server" Height="316px" Width="388px" /><br />
                <br />
                
                <asp:Label ID="lblImageDescription" runat="server" /><br />
                <br />
        
        
                <asp:Button ID="Btn_Previous" runat="server" Text="Previous" />
                <asp:Button ID="Btn_Next" runat="server" Text="Next" Width="64px" /><br />
                <br />
                <asp:Button ID="Btn_Play" runat="server" Text="Play" /><br />
                
        
                <cc1:SlideShowExtender ID="SlideShowExtender1"
                  AutoPlay="true" ImageDescriptionLabelID="lblImageDescription"
                   Loop="true" NextButtonID="Btn_Next" PlayButtonID="Btn_Play"
                    PlayButtonText="Play" PreviousButtonID="Btn_Previous"
                     SlideShowServiceMethod="GetSlides" StopButtonText="Stop"
                      TargetControlID="Image1" runat="server">
                </cc1:SlideShowExtender>       
            </div>

    ============

    Rachel

  • Re: adding a new feature to the Admin file

    06-28-2009, 6:56 PM
    • Contributor
      6,366 point Contributor
    • Lee Dumond
    • Member since 11-03-2004, 2:51 PM
    • Decatur, IL USA
    • Posts 1,168

    If you study how the file uploading works in the BeerHouse site, you ashould be able to easily adapt it to what you want. 

  • Re: adding a new feature to the Admin file

    06-28-2009, 9:05 PM
    • Member
      55 point Member
    • RaeKC
    • Member since 11-28-2008, 5:52 PM
    • Posts 338

    I'm not sure how to put it into the slide show.

    Rachel

  • Re: adding a new feature to the Admin file

    07-01-2009, 1:47 PM
    • Contributor
      6,366 point Contributor
    • Lee Dumond
    • Member since 11-03-2004, 2:51 PM
    • Decatur, IL USA
    • Posts 1,168

     The best thing to do is to put all of your slideshow images into a separate folder, say Images/slideshow.

    Then, in your GetSlides method, just pull all the slides from that folder to make the array of slides that the slideshow will use.

    using System;
    using System.Collections;
    using System.IO;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using AjaxControlToolkit;
    
    public partial class SlideShow : Page
    {
       protected void Page_Load(object sender, EventArgs e)
       {
       }
    
       [System.Web.Services.WebMethod, System.Web.Script.Services.ScriptMethod]
       public static Slide[] GetSlides()
       {
          string imagesPath = HttpContext.Current.Server.MapPath("~/images/slideshow/");
          DirectoryInfo directoryInfo = new DirectoryInfo(imagesPath);
          ArrayList slides = new ArrayList();
    
          foreach (FileInfo fileInfo in directoryInfo.GetFiles())
          {
             Slide slide = new Slide("images/slideshow/" + fileInfo.Name, "The Old House", fileInfo.Name);
             slides.Add(slide);
          }
    
          return slides.Cast<Slide>().ToArray();
       }
    }


     

  • Re: adding a new feature to the Admin file

    07-01-2009, 3:36 PM
    • Member
      55 point Member
    • RaeKC
    • Member since 11-28-2008, 5:52 PM
    • Posts 338

    Thanks Lee.

    Rachel

Page 1 of 1 (5 items)