Filter on custom modules
Hello,
I have made a custom module, while looking at the reference code I found how to filter based on the URL name.
DynamicContent produktenNachLokationen = dynamicModuleManager.GetDataItems(produktenNachLokationType).Where("UrlName = \"" + locationName + "\"").First();
Hi Rick -
1.
var taxonomy = TaxonomyManager.GetManager().GetTaxonomies<
FlatTaxonomy
>().Where(
2.
t => t.Name == "Region").Single().Taxa.Where(
3.
t => t.Title == this.Region).SingleOrDefault();
1.
DynamicContent produktenNachLokationen = dynamicModuleManager.GetDataItems(produktenNachLokationen)
2.
.Where(x => x.UrlName == new Lstring(locationName) &&
3.
x.GetValue<
IList
<Guid>>("Region").Equals(taxonomy.Id)).FirstOrDefault();
1.
using Telerik.Sitefinity.Taxonomies;
2.
using Telerik.Sitefinity.Taxonomies.Model;
3.
using Telerik.Sitefinity.Model;
Hi Josh,
Thanks for helping! Your code seems to work just fine. The only thing is, the result set contains all module items twice! Any idea why that is?
Kind regards, Tys
Hi Tys -
Ah, forgot about that. Thanks! Now it works totally as it should!
Ha! No worries. Glad it's working for ya!