How to display only certain categories / + ability to list available categories

Last post 08-03-2011, 7:14 AM by Kenneth. 5 replies.
Sort Posts: Previous Next
  •  07-30-2011, 3:36 PM 69067

    How to display only certain categories / + ability to list available categories

    Is there a way to display only certain categories? 
    It would also be nice to be able to generate a list of available categories so I can create links to pages that would only show those pictures within that particular category.
     
    Thanks,
     
    Rob
  •  08-01-2011, 7:52 AM 69115 in reply to 69067

    Re: How to display only certain categories / + ability to list available categories

    Hi rmw82,
     
    Please try property "CategoryID ".
     
     GalleryBrowser1.CategoryID = "1"; 
     
    Regards,
     
    ken
  •  08-01-2011, 2:41 PM 69140 in reply to 69115

    Re: How to display only certain categories / + ability to list available categories

    Thanks, Ken.
     
    Is there anyway to get a list of the available categories so I can dynamically list them and create links to each category?
     
    Thanks again,
     
    Rob
  •  08-02-2011, 10:47 AM 69171 in reply to 69140

    Re: How to display only certain categories / + ability to list available categories

    Hi rmw82,
     
    Try
     
    using (DotNetGallery.GalleryDataProvider provider = DotNetGallery.GalleryDataProvider.CreateInstance(Context, "~/GalleryFiles/"))
            {
                //get all category
                string[] categoryArray = provider.GetCategoryArray();
                for (int i = 0; i < categoryArray.Length; i++)
                {
                    //get id of all categories
                    //categoryArray[i] is the category id
                    label1.Text += categoryArray[i];
                }
            }
     
    Regards,
     
    ken
  •  08-02-2011, 2:49 PM 69182 in reply to 69171

    Re: How to display only certain categories / + ability to list available categories

    Ken,
     
    I appreciate your responses.  It seems that this will give me the ID numbers of the categories, which I need in order to filter the categories.  Is there an easy way to also retrieve the Category name?
     
    Thanks again,
     
    Rob
  •  08-03-2011, 7:14 AM 69216 in reply to 69182

    Re: How to display only certain categories / + ability to list available categories

    Hi rmw82,
     
    Please try 
     
    using (DotNetGallery.GalleryDataProvider provider = DotNetGallery.GalleryDataProvider.CreateInstance(Context, "~/GalleryFiles/"))
            {
                //get all category
                string[] categoryArray = provider.GetCategoryArray();
                for (int i = 0; i < categoryArray.Length; i++)
                {
                    string title;
                    string description;
                    string properties;
                    
                    if (provider.GetCategoryInfo(categoryArray[i].ToString(), out title, out description, out properties))
                    {
                        //title is the name of the category
                        label1.Text += title;
                    }
                }
            }
     
     
    Regards,
     
    ken
View as RSS news feed in XML