How to display the title from the category.config file in the album.config file

Last post 02-01-2010, 3:22 AM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  01-28-2010, 1:50 PM 58423

    How to display the title from the category.config file in the album.config file

    I am trying to make a dropdown list or a gridview of the titles of my categories so that a client can click on the title to view only those pictures.
     
    What I have tried to do is create an xmldatasource that is linked to the album.config file  my only problem is the album.config file only displays the category id and not the title.  The title of the category is in the Category Folder in the category.config file.
     
    Is there anyway to get the album.config file to look like this:
     

    <album id="null" name="Residential Main" nextcategoryid="6" lastPhotoTime="2010-01-28 10:40:18">

    <category id="2" albumid="null" title="Residential" description="" properties="" />

    <category id="3" albumid="null" title="Commercial" description="" properties="" />

    <category id="4" albumid="null" title="Fairbairn" description="" properties="" />

    <category id="5" albumid="null" title="TEst" description="" properties="" />

    </album>

     
     
     
    as opposed to it looking like this:

    <album id="null" name="Residential Main" nextcategoryid="6" lastPhotoTime="2010-01-28 10:40:18">

    <category id="2"  />

    <category id="3"  />

    <category id="4"  />

    <category id="5"  />

    </album>
     
    Your assistance is greatly appreciated.
  •  02-01-2010, 3:22 AM 58468 in reply to 58423

    Re: How to display the title from the category.config file in the album.config file

    Hi beth123,
     
    Try this example
     
    1. <%@ Page Language="C#" %>   
    2. <%@ Register TagPrefix="DotNetGallery" Namespace="DotNetGallery" Assembly="DotNetGallery" %>   
    3. <script runat="server">   
    4.     void Page_Load(object sender, EventArgs e)   
    5.     {   
    6.         using (DotNetGallery.GalleryDataProvider provider = DotNetGallery.GalleryDataProvider.CreateInstance(Context, "~/GalleryFiles/"))   
    7.         {   
    8.             //get all category   
    9.             string[] categoryArray = provider.GetCategoryArray();   
    10.             for (int i = 0; i < categoryArray.Length; i++)   
    11.             {   
    12.                 string title;   
    13.                 string description;   
    14.                 string properties;   
    15.                 if (provider.GetCategoryInfo(categoryArray[i].ToString(), out title, out description, out properties))   
    16.                 {   
    17.                     //show all title in label1   
    18.                     label1.Text += title;   
    19.                 }   
    20.             }   
    21.         }   
    22.     }   
    23.     
    24. </script>   
    25.   
    26. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">   
    27. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">   
    28. <head runat="server">   
    29.     <title></title>   
    30. </head>   
    31. <body>   
    32.     <form id="form1" runat="server">   
    33.         <asp:Label ID="label1" runat="server"></asp:Label>   
    34.         <DotNetGallery:GalleryBrowser runat="server" ID="gallery1" Width="720" Height="430" />   
    35.     </form>   
    36. </body>   
    37. </html>  
    Regards,
     
    Ken
View as RSS news feed in XML