Try Now
More in this section

Forums / Developing with Sitefinity / Custom Module: are multiple backend views possible?

Custom Module: are multiple backend views possible?

3 posts, 0 answered
  1. SteveV
    SteveV avatar
    178 posts
    06 Nov 2011
    16 Jan 2012
    Link to this post

    I have a custom module that was created from code rather than by use of the Module builder.  The module is used to create School Calendar Day Items that identify "out of session" dates and reasons (Holidays, Vacation, Staff Development Days, etc.)

    Each "SchoolCalendarDay" has a "SchoolYearCalendar" and a "SchoolCalendarDayType" associated with it. My table mappings are setup and working properly and look like this.

    MappingConfiguration<SchoolYearCalendar> schoolYearCalendarTableMapping = new MappingConfiguration<SchoolYearCalendar>();
    schoolYearCalendarTableMapping.HasProperty(y => y.Id).IsIdentity(Telerik.OpenAccess.Metadata.KeyGenerator.Guid);
    schoolYearCalendarTableMapping.HasProperty(y => y.StartDate).IsNotNullable();
    schoolYearCalendarTableMapping.HasProperty(y => y.EndDate).IsNotNullable();
    schoolYearCalendarTableMapping.HasProperty(y => y.CreatedBy).IsNotNullable();
    schoolYearCalendarTableMapping.HasProperty(y => y.CreateDate).IsNotNullable();
    MappingConfiguration<SchoolCalendarDay> calendarDayTableMapping = new MappingConfiguration<SchoolCalendarDay>();
    calendarDayTableMapping.HasProperty(d => d.Id).IsIdentity(Telerik.OpenAccess.Metadata.KeyGenerator.Guid);
    calendarDayTableMapping.HasProperty(d => d.SchoolYearCalendarId).IsNotNullable();
    calendarDayTableMapping.HasProperty(d => d.Date).IsNotNullable();
    calendarDayTableMapping.HasProperty(d => d.CreatedBy).IsNotNullable();
    calendarDayTableMapping.HasProperty(d => d.CreateDate).IsNotNullable();
    calendarDayTableMapping.HasProperty(d => d.SchoolDayTypeId).IsNotNullable();
    calendarDayTableMapping.HasProperty(d => d.AdditionalInfo);
    MappingConfiguration<SchoolCalendarDayType> calendarDayTypeTableMapping = new MappingConfiguration<SchoolCalendarDayType>();
    calendarDayTypeTableMapping.HasProperty(t => t.Id).IsIdentity(Telerik.OpenAccess.Metadata.KeyGenerator.Autoinc);
    calendarDayTypeTableMapping.HasProperty(t => t.Description).IsNotNullable();
    calendarDayTypeTableMapping.HasProperty(t => t.SortOrder).IsNotNullable();
    calendarDayTableMapping.HasAssociation(d => d.DayType).ToColumn("school_day_type_id");
    calendarDayTableMapping.HasAssociation(d => d.SchoolCalendar).ToColumn("school_year_calendar_id");
    List<MappingConfiguration> mappings = new List<MappingConfiguration>();

    I created a "SchoolCalendarAdminView" and "AddEditSchoolCalendarView" controls so I can add and edit new SchoolCalendarDay items. While everything works properly, I also need a way to add/edit "SchoolYearCalendar" and "SchoolCalendarDayType" items.

    Is it possible for a module to have multiple backend views or do I need to create seperate SchoolYearCalendar and SchoolCalendarDayType modules?


  2. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    03 Nov 2014
    18 Jan 2012
    Link to this post
    Hi Steve,

    Yes, a single module can have different Backend pages associated with it and each page would invoke different create/edit views - it's just a matter of definitions. For example the Locations module from the SDK has the following definition:

    var locationsGridView = new MasterGridViewElement(backendContentView.ViewsConfig)
        ViewName = LocationsDefinitions.BackendListViewName,
        ViewType = typeof(MasterGridView),
        AllowPaging = true,
        DisplayMode = FieldDisplayMode.Read,
        ItemsPerPage = 50,
        SearchFields = "Title",
        SortExpression = "Title ASC",
        Title = "Locations",
        WebServiceBaseUrl = "~/Sitefinity/Services/Content/Locations.svc/"

    As you can see there is a property named ViewName and it points to LocationsDefinitions.BackendListViewName, which is the name for the grid view for the Locations. You can have several such views in one module.

    All the best,
    Lubomir Velkov
    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
  3. SteveV
    SteveV avatar
    178 posts
    06 Nov 2011
    19 Jan 2012
    Link to this post
    Hi Lubomir,

    Thanks for the info.

3 posts, 0 answered