Dashboard widget - is there a simple way to do it?


I have been look a looking for ways to make a episerver Dashboard widget(not sure this is the rigth word for it) with c# + razor or som simple way.

There are some things in the docs about dashboard view, component and container - but no real explanation about what each of them is and how to use them. Any full samples?

I just need some simple component to export some custom data for users and discounts in episerver. Ofcause that could easily be build with a custom site in the website - but I think that it belong in the episerver backend. What is the simple(and right) way to build dashboard widgets for episerver 10?

Oct 18, 2017 9:02

Previously we've used IFrameComponent in WebForms to make quick plugins for EPiServer. Just create an .aspx that has the attribute IFrameComponent and inherits from ContentWebFormsBase.

[IFrameComponent(Url = "~/Plugins/PublishedTo.aspx", ReloadOnContextChange = true, PlugInAreas = "/episerver/cms/assets", Title = "Document connector", Categories = "cms", MinHeight = 100, MaxHeight = 500)]

    public partial class PublishedTo : EPiServer.Shell.WebForms.ContentWebFormsBase
// ....

 If you want to use MVC, have a look at this blog post: https://devblog.gosso.se/2017/06/convert-deprecated-gadgets-to-components-in-episerver/

Good luck!

Oct 18, 2017 9:37

I have tried making a MVC IFrameComponent from the guide above

[IFrameComponent(Url = "EventReportComponent",
Categories = "dashboard",
Title = "Get reports for Events",
MinHeight = 300)]
public class EventReportComponentController : Controller
//[Authorize(Roles = "WebEditors,WebAdmins")]
public ActionResult Index()
return View();

RouteTable.Routes.MapRoute("EventReportDashboard", "/EventReportComponent/{action}",
new { controller = "EventReportComponent", action = "index", id = UrlParameter.Optional });

With the above code I get this exception:

Can't resolve non-rooted path 'EventReportComponent'

If I add a slash to: IFrameComponent(Url = "/EventReportComponent", i get this error:

EPiServer.ServiceLocation.ActivationException: Activation error occurred while trying to get instance of type EPiDashboardController, key "" ---> StructureMap.Building.StructureMapBuildException: Error while building type EPiServer.Shell.ViewComposition.DefaultViewManager.  See the inner exception for details
1.) new DefaultViewManager(Enumerable of EPiServer.Shell.ViewComposition.IViewProvider with all registered instances, Enumerable of EPiServer.Shell.ViewComposition.IViewTransformer with all registered instances, *Default of IComponentManager*)
2.) EPiServer.Shell.ViewComposition.DefaultViewManager
3.) Instance of EPiServer.Shell.ViewComposition.IViewManager (EPiServer.Shell.ViewComposition.DefaultViewManager)
4.) new Bootstrapper(*Default of IViewManager*, *Default of ModuleTable*, *Default of IClientResourceService*)
5.) EPiServer.Shell.UI.Bootstrapper
6.) Instance of EPiServer.Shell.Web.Mvc.IBootstrapper (EPiServer.Shell.UI.Bootstrapper)
7.) new EPiDashboardController(*Default of IBootstrapper*)
8.) EPiServer.Shell.UI.Controllers.EPiDashboardController
9.) Instance of EPiServer.Shell.UI.Controllers.EPiDashboardController
10.) Container.GetInstance(EPiServer.Shell.UI.Controllers.EPiDashboardController)
 ---> System.ArgumentException: Unable to find a module by assembly 'Vertica.**.Website, Version=, Culture=neutral, PublicKeyToken=null'
Parameter name: moduleAssembly
   at EPiServer.Shell.Paths.ToResource(Assembly moduleAssembly, String moduleRelativeResourcePath)
   at EPiServer.Shell.ViewComposition.IFrameComponentAttribute.CreateComponentDefinition(Type attributedType)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at EPiServer.Shell.ViewComposition.AttributedComponentProvider.GetComponentDefinitions()
   at EPiServer.Shell.ViewComposition.ComponentManager.ListAll()
   at EPiServer.Shell.ViewComposition.DefaultViewManager..ctor(IEnumerable`1 viewProviders, IEnumerable`1 viewTransformers, IComponentManager componentManager)
   at lambda_method(Closure , IBuildSession , IContext )
   --- End of inner exception stack trace ---
   at lambda_method(Closure , IBuildSession , IContext )
   at StructureMap.Building.BuildPlan.Build(IBuildSession session, IContext context) in c:\BuildAgent\work\a395dbde6b793293\src\StructureMap\Building\BuildPlan.cs:line 151
   at StructureMap.SessionCache.GetObject(Type pluginType, Instance instance, ILifecycle lifecycle) in c:\BuildAgent\work\a395dbde6b793293\src\StructureMap\SessionCache.cs:line 93
   at StructureMap.SessionCache.GetDefault(Type pluginType, IPipelineGraph pipelineGraph) in c:\BuildAgent\work\a395dbde6b793293\src\StructureMap\SessionCache.cs:line 68
   at StructureMap.Container.GetInstance(Type pluginType) in c:\BuildAgent\work\a395dbde6b793293\src\StructureMap\Container.cs:line 337
   at EPiServer.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key)
   --- End of inner exception stack trace ---
   at EPiServer.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key)
   at EPiServer.Shell.Web.Mvc.ModuleControllerFactory.CreateController(RequestContext requestContext, String controllerName)
   at EPiServer.Shell.Web.Mvc.ModuleMvcHandler.ProcessRequestInit(HttpContextBase httpContext)
   at EPiServer.Shell.Web.Mvc.ModuleMvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

I seems to be goging well a good part of the way until it somehow expects something different?!
(I ofcause have the IFrameComponent in the same assembly as the websitet)

Oct 30, 2017 8:48

I get the same error Morten Holmgaard dit you find a way to use IFrameComponent

Sep 11, 2018 8:31

No I gave up.

Sep 11, 2018 8:35

ah i found the error, looking here: https://blog.mathiaskunto.com/2015/01/25/episerver-7-5-argumentexception-unable-to-find-a-module-by-assembly-assembly-version1-0-0-0-cultureneutral-publickeytokennull/

Sep 11, 2018 11:11


I ran in to similar problem.

First thing was that the url was specified wrong. I was missing a "/" and you should add the action after aswell.

Second was that i had to add my project assembly to web.config in protectedModules.

        Url = "/MissingHousePagesComponent/Index",
        Categories = "dashboard",
        Title = "Get reports for Events",
        PlugInAreas = PlugInArea.AssetsDefaultGroup,
        MinHeight = 300)]
    public class MissingHousePagesComponentController : Controller
        //[Authorize(Roles = "WebEditors,WebAdmins")]
        public ActionResult Index()
            return View("~/Views/Gadgets/MissingHousePages/Index.cshtml");

 <protectedModules rootPath="~/EPiServer/">
      <add name="My.Project">
          <add assembly="My.Project" />
      <add name="Shell" />
      <add name="CMS" />
      <add name="EPiServer.Packaging.UI" />
Edited, Sep 14, 2018 14:43
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.