How I can get the category name which I newly created in the Gallery browser

Last post 12-20-2013, 8:19 AM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  12-20-2013, 1:09 AM 78642

    How I can get the category name which I newly created in the Gallery browser

    Hi,

     

                  I am using asp.net image gallery (classic layout), I am binding Images to that gallery by folder name 'Image

    Gallery' in my server. In the Gallery there is a gallery browser for uploading new files. In that there is also an option

     

    "New Category" for creating categories, Now I created some categories with names like as Pages, Emails, Banners etc..

     

    Now I checked in the 'ImageGallery' folder It's creating folders like Category1, Category2 like that.. But in the gallery

     

    it shows the category names as Pages, Emails etc. I want to get the exact category names (pages, Emails etc) what

     

    I creating in the gallery not Category1, Category2 etc..

    How can I achieve this.. 

     

    Please give quick reply.. 


    Regards,
    Narendra
  •  12-20-2013, 8:19 AM 78645 in reply to 78642

    Re: How I can get the category name which I newly created in the Gallery browser

    Hi narendrababu,

     

    You can use the code below to get the category name.  title is the category name, "~/GalleryFiles/" is your gallery folder location.

     

    1. void Page_Load(object sender, EventArgs e)  
    2. {  
    3.     using (DotNetGallery.GalleryDataProvider provider = DotNetGallery.GalleryDataProvider.CreateInstance(Context, "~/GalleryFiles/"))  
    4.     {  
    5.         //get all category  
    6.         string[] categoryArray = provider.GetCategoryArray();  
    7.         for (int i = 0; i < categoryArray.Length; i++)  
    8.         {  
    9.             string title;  
    10.             string description;  
    11.             string properties;  
    12.               
    13.             if (provider.GetCategoryInfo(categoryArray[i].ToString(), out title, out description, out properties))  
    14.             {  
    15.                 //title is the category name  
    16.                 //show all title in label1  
    17.                 label1.Text += title;  
    18.             }  
    19.         }  
    20.     }  
    21. }  
     

    Regards,

     

    Ken 

View as RSS news feed in XML