Please use the below approach for filtering the items by related data: http://docs.sitefinity.com/example-query-dynamic-content-by-related-data
Here is also another sample code for more details on filtering dynamic modules by related pages:
Type schoolType = TypeResolutionService.ResolveType(
var contentLinksManager = ContentLinksManager.GetManager();
// the type of your module which has Pages as related data
// the ID of the Page you would like to filter by.
Guid PageNodeId =
// here you get the IDs of dynamic module items
// which has as related data a Page with the specified ID
var parentItemContentLinks = contentLinksManager.GetContentLinks()
.Where(c => c.ParentItemType == parentType && c.ChildItemId == PageNodeId)
.Select(c => c.ParentItemId).ToList();
// here you get the filtered dynamic module items by their IDs
var result = dynamicModuleManager.GetDataItems(schoolType)
.Where(d => parentItemContentLinks.Contains(d.OriginalContentId) && d.Status == ContentLifecycleStatus.Live);
Please note to replace the dynamic module type with your module type and to replace the pageNodeId with an Id of your page you want to filter the dynamic items by.
I have also recorded a short video demonstrating the result after executing the code: http://screencast.com/t/wdiXNIeT
You can use the above approach to filter by two related data fields.
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal
and vote to affect the priority of the items