Re: Get Category ID's

  •  02-21-2011, 12:27 AM

    Re: Get Category ID's

    Hi englishsteve,
     
    Please try the example below
     
    1. <%@ Page Language="c#" AutoEventWireup="false" %>  
    2.   
    3. <%@ Register TagPrefix="DotNetGallery" Namespace="DotNetGallery" Assembly="DotNetGallery" %>  
    4.   
    5. <script runat="server">  
    6.       
    7.     protected override void OnInit(EventArgs e)  
    8.     {  
    9.         base.OnInit(e);  
    10.   
    11.         GalleryBrowser1.Layout = "SlideShow";  
    12.         GalleryBrowser1.AllowEdit = true;  
    13.         GalleryBrowser1.AllowPostComment = true;  
    14.         GalleryBrowser1.AllowShowComment = true;  
    15.         using (DotNetGallery.GalleryDataProvider provider = DotNetGallery.GalleryDataProvider.CreateInstance(Context, "~/GalleryFiles/"))  
    16.         {  
    17.             string[] categoryArray = provider.GetCategoryArray();  
    18.             for (int i = 0; i < categoryArray.Length; i++)  
    19.             {  
    20.                 string title;  
    21.                 string description;  
    22.                 string properties;  
    23.                 string physicalPath = provider.PhysicalDirectory;  
    24.                 string virtualPath = provider.VirtualDirectory;  
    25.                 ListItem l1 = new ListItem();  
    26.                 ddlCategoryID.Items.Add(l1);  
    27.                 if (provider.GetCategoryInfo(categoryArray[i].ToString(), out title, out description, out properties))  
    28.                 {  
    29.                     l1.Text = categoryArray[i][0].ToString();  
    30.                     l1.Value = title;  
    31.                 }  
    32.   
    33.             }  
    34.   
    35.         }  
    36.     }  
    37. </script>  
    38.   
    39. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">  
    40. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">  
    41. <head>  
    42.     <title>SlideShow Layout - DotNetGallery</title>  
    43.     <link href="Sample.css" type="text/css" rel="stylesheet" />  
    44. </head>  
    45. <body>  
    46.     <form id="form1" runat="server">  
    47.         <a href="#" onclick="thegallerybrowser.ShowEditor();return false;">Admin Console</a>  
    48.         <asp:DropDownList ID="ddlCategoryID" runat="server">  
    49.         </asp:DropDownList>  
    50.         <DotNetGallery:GalleryBrowser runat="server" ID="GalleryBrowser1" Width="720" Height="400" />  
    51.     </form>  
    52. </body>  
    53. </html> 
     Regards,
     
    ken
View Complete Thread