Re: Get Category ID's

  •  02-17-2011, 7:46 AM

    Re: Get Category ID's

    OK, I got this piece of code tfrom a previous post that gets the data I'm looking for. Now what I want ot do is bind it to a dropdownlist if possible. Have the categoryID as the datavaluefield and the title as the datatextfield.
     

    using (DotNetGallery.GalleryDataProvider provider = DotNetGallery.GalleryDataProvider.CreateInstance(Context, "~/MyGallery/"))

    {

    //get all category

    string[] categoryArray = provider.GetCategoryArray();

    for (int i = 0; i < categoryArray.Length; i++)

    {

    string title;

    string description;

    string properties;

    string physicalPath = provider.PhysicalDirectory;

    string virtualPath = provider.VirtualDirectory;

     

    if (provider.GetCategoryInfo(categoryArray[i].ToString(), out title, out description, out properties))

    {

    //show all title in label1

    //title is the name of the category

     

    string s2 = "Category id = " + (i+1).ToString() + " title = " + title + "<br/>";

    Label1.Text += s2;

    }

    }

    }

View Complete Thread