Creating the frontend definitions

You must wrap all of the frontend views in a ContentViewControlElement and return it in the DefineLocationsFrontendContentView method of the definitions class. To do this, you must perform the following:

  1. Open the LocationsDefinitions.cs file.
  2. Add the following using statement:

    • using LocationsModule.Web.UI.Public;

  3. In the LocationsDefinitions class, implement the DefineLocationsFrontendContentView method in the following way:

    public static ContentViewControlElement DefineLocationsFrontendContentView(ConfigElement parent)
    {
        var controlDefinition = new ContentViewControlElement(parent)
        {
            ControlDefinitionName = LocationsDefinitions.FrontendDefinitionName,
            ContentType = typeof(LocationItem)
        };
     
        var LocationsListView = new ContentViewMasterElement(controlDefinition.ViewsConfig)
        {
            ViewName = LocationsDefinitions.FrontendListViewName,
            ViewType = typeof(MasterListView),
            AllowPaging = true,
            DisplayMode = FieldDisplayMode.Read,
            ItemsPerPage = 6,
            FilterExpression = DefinitionsHelper.PublishedOrScheduledFilterExpression,
            SortExpression = "Title ASC"
        };
     
        controlDefinition.ViewsConfig.Add(LocationsListView);
     
        var newsDetailsView = new ContentViewDetailElement(controlDefinition.ViewsConfig)
        {
            ViewName = LocationsDefinitions.FrontendDetailViewName,
            ViewType = typeof(DetailsView),
            ShowSections = false,
            DisplayMode = FieldDisplayMode.Read
        };
     
        controlDefinition.ViewsConfig.Add(newsDetailsView);
     
        return controlDefinition;
    }

Related topics:

Feedback

How useful is this article?

Tell us more

Submit
Your message was successfully sent.

We appreciate your feedback.

Your message could not be sent.

OK