Re: Get Category ID's

  •  03-14-2011, 10:48 PM

    Re: Get Category ID's

    Hi englishsteve,
     
    Please try the new example
     
    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.   
    19.             for (int i = 0; i < categoryArray.Length; i++)  
    20.             {  
    21.                 string title;  
    22.                 string description;  
    23.                 string properties;  
    24.                 string physicalPath = provider.PhysicalDirectory;  
    25.                 string virtualPath = provider.VirtualDirectory;  
    26.                 ListItem l1 = new ListItem();  
    27.                 ddlCategoryID.Items.Add(l1);  
    28.                 if (provider.GetCategoryInfo(categoryArray[i], out title, out description, out properties))  
    29.                 {  
    30.                     l1.Text = categoryArray[i];  
    31.                     l1.Value = title;  
    32.                 }  
    33.   
    34.             }  
    35.   
    36.         }  
    37.     }    
    38. </script>  
    39.   
    40. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">  
    41. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">  
    42. <head>  
    43.     <title>SlideShow Layout - DotNetGallery</title>  
    44.     <link href="Sample.css" type="text/css" rel="stylesheet" />  
    45. </head>  
    46. <body>  
    47.     <form id="form1" runat="server">  
    48.         <a href="" onclick="thegallerybrowser.ShowEditor();return false;">Admin Console</a>  
    49.         <asp:DropDownList ID="ddlCategoryID" runat="server">  
    50.         </asp:DropDownList>  
    51.         <DotNetGallery:GalleryBrowser runat="server" ID="GalleryBrowser1" Width="720" Height="400" />  
    52.     </form>  
    53. </body>  
    54. </html> 
     
    Regards,
     
    ken
View Complete Thread