Creating the Locations view
After you create the master list view and the details view, you must create the Locations view control. Perform the following:
-
From the context menu of folder Web » UI » Public, click Add » Class...
-
In the Name input field, enter LocationsView.
-
Open the file in Visual Studio and add the following namespaces:
using Telerik.Sitefinity.Modules.Pages.Web.UI;
using Telerik.Sitefinity.Web.UI.ContentUI;
-
Change the class definition to:
[RequireScriptManager]
class LocationsView : ContentView
{
}
-
Specify the module name by pasting this code:
public override string ModuleName
{
get
{
if (String.IsNullOrEmpty(base.ControlDefinitionName)) return "Locations";
return base.ModuleName;
}
set
{
base.ModuleName = value;
}
}
-
Specify the name of the configuration definition for the control in the following way:
public override string ControlDefinitionName
{
get
{
if (String.IsNullOrEmpty(base.ControlDefinitionName))
return LocationsDefinitions.FrontendDefinitionName;
return base.ControlDefinitionName;
}
set
{
base.ControlDefinitionName = value;
}
}
-
Define the name of the master view:
public override string MasterViewName
{
get
{
if (!String.IsNullOrEmpty(base.MasterViewName))
return base.MasterViewName;
return LocationsDefinitions.FrontendListViewName;
}
set
{
base.MasterViewName = value;
}
}
-
Define the name of the details view:
public override string DetailViewName
{
get
{
if (!String.IsNullOrEmpty(base.DetailViewName))
return base.DetailViewName;
return LocationsDefinitions.FrontendDetailViewName;
}
set
{
base.DetailViewName = value;
}
}
-
Provide a property for the text that is shown when the box in the designer is empty:
public override string EmptyLinkText
{
get
{
return "Edit";
}
}
-
Save the file.
First, you specify the module name. Then, you set the name of the configuration definition that the control uses to construct the views. Finally, you define the views that are shown when the control is in the ContentViewDisplayMode.Master and theContentViewDisplayMode.Detail states. You reference the master list view and the details view.