Try Now
More in this section

Forums / Developing with Sitefinity / Custom module get items by State

Custom module get items by State

2 posts, 0 answered
  1. BB
    BB avatar
    7 posts
    05 Oct 2012
    18 Mar 2014
    Link to this post
    I created custom module to display locations. I'm using data type "Address". So it's easy to add a location. However when I try to get items by location, I don't know how.

      var myLocations = dynamicModuleManager.GetDataItems(rmylocationType)
                        .Where(d => d.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live
    && (?? I don't know this part. GetValue<Address>>????)
  2. Ivan D. Dimitrov
    Ivan D. Dimitrov avatar
    310 posts
    26 Mar 2015
    21 Mar 2014
    Link to this post

    You have detailed code reference for each of your modules located under Administration->Module Builder->Your module-> Code Reference for Your module. The correct way for you to get the field in question is presented below.

    DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
             Type MyType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.YourModuleName.YourContentTypeName");
             var TheType= dynamicModuleManager.GetDataItems(MyType).FirstOrDefault();
             var MyField = TheType.GetValue("FieldName");

    Ivan D. Dimitrov
    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
2 posts, 0 answered