Generic Content by Category
I am trying to list generic content by category using the Fluent API. My approach is this:
Try using this code
Thanks for the reply Ivan.
You have to add using Telerik.Sitefinity.Model and you should be able to call GetValue. In the BETA there are no methods in the fluent API that allows you to retrieve DynamicFileds data directly. We have logged a task for exposing such methods. Currently, the easiest way is using
GetValue as my code shows.
All the best,
the Telerik team
Thanks Ivan. That did it!
Hey Ivan, I am in the process of upgrading to beta 2. Did the extension methods move to a different namespace?
The namespace is still Telerik.Sitefinity.Model. We are in process of changing the API and this is why AlbumSingularFacade is returned by Albums() method. You could use this code instead
I have tried the below code and got it working.
cat1Id is the id of your taxon. Below is a sample that shows how to get the Taxa Id by name.
can you please tell me how do I get the content items passing the category taken from the taxonomy?
Please take a look at this forum post
the Telerik team
Great thread, it was all I was looking for, thanks! :)
I ran into an exception when you delete a category. This code seems to get around it.
/// Get the category ID by the category name
/// <param name="categoryName">Name of the category. Must be an exact match</param>
/// <returns>Guid of category, or empty guid if null</returns>
private Guid GetCategoryIDByCategoryName(string categoryName)
Guid id = Guid.Empty;
TaxonomyManager taxonomyManager = TaxonomyManager.GetManager();
string taxonomyName = "categories";
HierarchicalTaxonomy taxonomy1 = taxonomyManager.GetTaxonomies<HierarchicalTaxonomy>().Where(t => t.Name.ToLower() == taxonomyName.ToLower()).SingleOrDefault();
if (taxonomy1 != null)
var taxonomyForCategory = taxonomyManager.GetTaxa<HierarchicalTaxon>().Where(t => t.Name.ToLower() == categoryName.ToLower()).Single();
if (taxonomyForCategory != null)
id = taxonomyForCategory.Id;
catch (Exception ex)
//Logging.LogWarning("Error getting news rotator category taxonomy", ex);