EPiServer 7 Shell

Vote:
 

Im trying to do a shell style application inside EPi.

Im using MVC with razor, but i have som issues.
Ive looked at this:
http://sdkbeta.episerver.com/SDK-html-Container/?path=/SdkDocuments/EPiServerFramework/7/Knowledge%20Base/Developer%20Guide/OnlineCenter/OnlineCenter.htm&vppRoot=/SdkDocuments//EPiServerFramework/7/Knowledge%20Base/Developer%20Guide/#MVC

According to the example you use

<%=Page.ClientResources("Shell")%>
<%=Page.ClientResources("ShellLightTheme")%>
<%=Page.ClientResources("Navigation")%>

    

but since i use razor i just did

@Page.ClientResources("Shell")

    

However i get the error: Cannot perform runtime binding on a null reference

Am i missing something ?
I have the following usings:

@using EPiServer.Shell
@using EPiServer.Shell.Navigation
@using EPiServer.Shell.Web.UI
@using EPiServer.Shell.Web.Mvc.Html
@using EPiServer.Shell.Web.Resources

    

#62721
Nov 01, 2012 14:56
Vote:
 

Try to add this using:

  • EPiServer.Framework.Web.Mvc.Html
  • EPiServer.Framework.Web.Resources

Could you provide stack trace?

#62745
Nov 02, 2012 9:23
Vote:
 

Found a way after a lot of browsing of the EPi Binaries.
This seams to do the trick for me:

<!-- Shell -->
@Html.Raw(EPiServer.Framework.Web.Resources.ClientResources.RenderResources("ShellCore"))
@Html.Raw(EPiServer.Framework.Web.Resources.ClientResources.RenderResources("ShellWidgets"))
<!-- LightTheme -->
@Html.Raw(EPiServer.Framework.Web.Resources.ClientResources.RenderResources("ShellCoreLightTheme"))
<!-- Navigation -->
@Html.Raw(EPiServer.Framework.Web.Resources.ClientResources.RenderResources("Navigation"))
<!-- Dojo Dashboard -->
@Html.Raw(EPiServer.Framework.Web.Resources.ClientResources.RenderResources("DojoDashboardCompatibility"))

    

#62746
Nov 02, 2012 9:23
Vote:
 

Just for kicks i tried adding your suggested namespaces and the normal @Page.ClientResources("Shell") but still same error.
Here is a stack trace of it.

[RuntimeBinderException: Cannot perform runtime binding on a null reference]
   CallSite.Target(Closure , CallSite , Object , String ) +264
   System.Dynamic.UpdateDelegates.UpdateAndExecute2(CallSite site, T0 arg0, T1 arg1) +975
   CallSite.Target(Closure , CallSite , Object , String ) +373
   System.Dynamic.UpdateDelegates.UpdateAndExecute2(CallSite site, T0 arg0, T1 arg1) +975
   ASP._Page_Views_Shared_Sleek_cshtml.Execute() in c:\EPiServer\Sites\EPi7MVC\Views\Shared\Sleek.cshtml:87
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +126
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +196
   System.Web.WebPages.WebPageBase.Write(HelperResult result) +89
   System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body) +233
   System.Web.WebPages.WebPageBase.PopContext() +282
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +384
   System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +33
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +970500
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +265
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +970320
   System.Web.Mvc.Controller.ExecuteCore() +159
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335
   EPiServer.Shell.Web.Mvc.ModuleMvcHandler.ProcessController(IController controller) +50
   EPiServer.Shell.Web.Mvc.ModuleMvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +28
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +405
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375

But as i said in previous post, i found a way by directly use the static class ClientResources and then i got some pointers from javaconsole to change Shell to ShellCore and added ShellWidgets, and renamed ShellLightTheme to ShellCoreLightTheme, and also added DojoDashboardCompatibility. Now i got a good working top global navigation looking just like the real thing and no errors or warning in the console.

#62747
Nov 02, 2012 9:30
Vote:
 

Exactly, you can make it shorter when adding usings:

@using EPiServer.Framework.Web.Resources

@Html.Raw(ClientResources.RenderResources("Name"))

    

#62748
Nov 02, 2012 9:30
Vote:
 

Yeah i know, did that afterwards. After confirming that it actually worked.

However the guide for this (http://sdkbeta.episerver.com/SDK-html-Container/?path=/SdkDocuments/EPiServerFramework/7/Knowledge%20Base/Developer%20Guide/OnlineCenter/OnlineCenter.htm&vppRoot=/SdkDocuments//EPiServerFramework/7/Knowledge%20Base/Developer%20Guide/#MVC) should be updated.

Not only is the Shell, and ShellLightTheme obselete.

The stuff needed to be changed and added is the following resources:
ShellCore (instead of obsolete: Shell)
ShellWidgets (new ?)
ShellCoreLightTheme (instead of obsolete: ShellLightTheme)
Navigation
DojoDashboardCompatibility (new ?)

The Html.ShellInitializationScript() and Html.GlobalMenu() still works if you wrap them with Html.Raw().

#62749
Nov 02, 2012 9:37
Vote:
 

Thanks for the report. I have added a bug to update the SDK for EPiServer 7.

#62752
Nov 02, 2012 9:55
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.