1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Need help with a simple module filter query

Need help with a simple module filter query

2 posts, 0 answered
  1. David
    David avatar
    99 posts
    Registered:
    06 Sep 2012
    09 May 2012
    Link to this post
    The following code was generated by Sitefinity.

    Question 1: How should the Where clause be written if the the value "Some UrlName" is stored in a variable called urlName?

    var myFilteredCollection = dynamicModuleManager.GetDataItems(myTestModuleType).Where("UrlName = \"Some UrlName\"");

    QUestion 2: How should the Where clause be written if there are 2 condititions, such as "UrlName ="  & urlName & " And  SIteName =" & siteName
  2. Dimitar Dimitrov
    Dimitar Dimitrov avatar
    35 posts
    Registered:
    19 Jun 2017
    09 May 2012
    Link to this post
    Hello David,

    Here is a sample:
    var myFilteredCollection = dynamicModuleManager.GetDataItems(myTestModuleType).Where( i=> i.GetValue<string>("UrlName") == urlName && i.GetValue<string>("SiteName") == siteName);


    Kind regards,
    Dimitar Dimitrov
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered