Locations module: Create the Locations view
After you Locations module: Create the designer viewLocations module: Create the locations details view, you must create the Locations view widget. Perform the following:
- In Visual Studio, expand the LocationsModule project and open the context menu of the Web folder.
- Click UI » Public and then click Add » Class...
- In the Name input field, enter LocationsView.
- Add the following namespaces to the LocationsView class:
using Telerik.Sitefinity.Web.UI.ContentUI;
using Telerik.Sitefinity.Modules.Pages.Web.UI;
using Telerik.Sitefinity.Web.UI.ControlDesign;
using LocationsModule.Web.UI.Public.Designers;
- Change the class definition to:
[RequireScriptManager]
[ControlDesigner(typeof(LocationsViewDesigner))]
public class LocationsView : ContentView
{
}
- Specify the module name by pasting this code:
public override string ModuleName
{
get
{
if (String.IsNullOrEmpty(base.ControlDefinitionName)) return LocationsModule.ModuleName;
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.
In the procedure above, you first 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 the ContentViewDisplayMode.Detail states. You reference the master list view and the details view.