Skip to content

Implementation

Ahmad edited this page Feb 3, 2023 · 3 revisions

Web Pages Instructions

Note: All ESDC internal web pages MUST use the ESDC sub theme.

For ASPX

When adding new pages to your project, these pages will need to inherit the "GoC.WebTemplate.BasePage" provided in the Web Template package. The BasePage provides the functionality for the language toggle.

  • Add a new page:
    • From your project, click "Add/New Item";
    • Select "Web Form with Master Page";
    • Navigate and select one of the master pages under "GoC.WebTemplate";
    • Click "OK".
  • Inherit the BasePage of the Web Template:
    • In the code behind of the newly added page, change the inheritance from "System.Web.UI.Page" to "GoC.WebTemplate.BasePage".

For MVC

For the Views ensure you are using one of the provided Layout files that have been added to ~\Views\GoC.WebTemplate\

For the Controller there are 2 implementation options:

  1. Use GoC.WebTemplate.MVC.WebTemplateBaseController to inherit your controller.
  2. Use GoC.WebTemplate.MVC.ActionFilters.WebTemplateActionFilterAttribute by: (Coming Next Release)
    [WebTemplateActionFilter]
    public sealed class TestActionFilterController : Controller
    You can then access the WebTemplateModel by using the extention ViewData.GetWebTemplateModel(); inside a View Action

For CoreMVC

CoreMVC has some manual installation steps, make sure you have done all the additional CoreMVC installation steps.

For the Views ensure you are using one of the provided Layout files that can be referenced by ~\Views\GoC.WebTemplate\

For the Controller there are 2 implementation options:

  1. Use GoC.WebTemplate.CoreMVC.WebTemplateBaseController to inherit your controller. Set your controller's constructor to have the ModelAccessor injected and passed to the inherited base controller:

    public TestLayoutsController(GoC.WebTemplate.Components.Core.Services.IModelAccessor modelAccessor)
             : base(modelAccessor) { }
  2. Use GoC.WebTemplate.CoreMVC.ActionFilters.WebTemplateActionFilterAttribute by: (Coming Next Release)

    [WebTemplateActionFilter]
    public sealed class TestActionFilterController : Controller

    You can then access the WebTemplateModel by using the extention ViewData.GetWebTemplateModel(); inside a View Action

Possible other changes:

Language Toggle

The web template does manage the language toggle and stores the users language in session. It can be retrieved with the following key GoC.Template.Culture; You can leverage the built in language features of the Web Template or execute your own logic.

Configurations

The web template can be adapted to suit your needs, please review the configurations and properties of the template.

Clone this wiki locally