Separate folders as galleries: How to use GalleryPath

Last post 01-21-2011, 12:02 PM by VanAwful. 3 replies.
Sort Posts: Previous Next
  •  01-20-2011, 7:11 PM 65808

    Separate folders as galleries: How to use GalleryPath

    I'm new to DotNetGallery and fairly new to ASP.net. I am trying to setup a new photo gallery for my non-profit. I purchased DotNetGallery cause it seemed to have what I needed.
     
    I'm trying to setup a simple multi gallery photo page. To do this I need to have a folder for each type of photo with at least one subfolder under each. Problem I am having is that I can't seem to get folderPath to work.
     
    The line I am using is
     
       gallery1.FolderPath = "album1";
     
    This gives me a server error. Anyone have a code sample of how to do this? Nothing I've read so far is very clear how to make this work.
  •  01-20-2011, 8:38 PM 65810 in reply to 65808

    Re: Separate folders as galleries: How to use GalleryPath

    Hi VanAwful,
     
    Should be  gallery1.GalleryFolder = "~/photos";
     
    Regards,
     
    ken
  •  01-20-2011, 9:22 PM 65812 in reply to 65810

    Re: Separate folders as galleries: How to use GalleryPath

    Thank You Ken, but I tried this and it does not work.
     
    I created a blank asp.net page to work through this. My test folder, myPhotos, is in the root
     
    Here is the code:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <%@ Page Language="C#" %>
    <%@ Register TagPrefix="uc1" TagName="TopBanner" Src="banner.ascx" %>
    <%@ Register TagPrefix="DotNetGallery" Namespace="DotNetGallery" Assembly="DotNetGallery" %>

    <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">

    <head runat="server">
     <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
     <title>Untitled 1</title>

     <script type="text/c#" runat="server">
         // Obtain the gallery folder from query string
         string album;
         void Page_Load(Object sender, EventArgs e)
         {
             album = Request.QueryString["album"];
             if (album == null || album=="/")
                 gallery1.GalleryFolder = "~/myPhotos";
             gallery1.GalleryFolder = album;
         }
     </script>

    </head>
    <body>
    <form id="form1" runat="server">
     <div>
      <uc1:topbanner ID="TopBanner1" runat="server"></uc1:topbanner>
       <div id="CommonBody" align="center">
        <dotnetgallery:gallerybrowser runat="server" id="GalleryBrowser1" Width="780" Height="400" />
       </div>
     </div>
    </form>
    </body>
    </html>
    If I remove the script then the control works and points to the default folder: GalleryFiles.
  •  01-21-2011, 12:02 PM 65827 in reply to 65812

    Re: Separate folders as galleries: How to use GalleryPath

    Think I got it. Reading to many of the post that from versions previous to 3.x. This was causing me to mix old methods/properties with the new.
     
    I just had to update the script to use GalleryBrowser1.GalleryFolder. Now it works.
     
    The solution was right in front of me yet I didn't see it until two minutes ago. :)
View as RSS news feed in XML