MVC Razor PartialViews with DesktopModuleProxy

  1. #1

    MVC Razor PartialViews with DesktopModuleProxy

    Hi!

    I'm trying to add a module to desktop via a cshtml partial view. The thought being that my index view would contain the desktop and then one or more partialviews would have desktopmoduleproxies that would add additional modules to the desktop. I'm not getting any errors the desktop icon or startmenu entry both do not appear. I've tried adding the desktopmoduleproxy block directly to the view with no success. However if I add the module directly to the desktop it does show up leading me to believe the module code itself is correct. I'm using Ext.Net 2.0.0.0 with VS 2010 and MVC 4.

    Index.cshtml (view)
    @Html.X().ResourceManager()
    @(Html.X().Desktop().DesktopConfig(Html.X().DesktopConfig()
        .Wallpaper("/resources/wallpapers/desk.jpg")
        .ID("Desktop1")
    )
    )
    @Html.Partial("Security")
    Security.cshtml (partial view)
    @(Html.X().DesktopModuleProxy().Module(Html.X().DesktopModule()
    .ModuleID("Security")
    .Launcher(Html.X().MenuItem()
        .Icon(Icon.ApplicationXp)
        .Text("Security")
    )
    .Shortcut(Html.X().DesktopShortcut()
        .IconCls("x-im-shortcut")
        .Name("Security")
    )
    .Window(window => window.Add(Html.X().Window()
        .Border(false)
        .Title("Security")
            .Html("Hi")
        )
    )
    )
    )
    HomeController.cs
    namespace Core.Controllers
    {
        using System.Web.Mvc;
        using Core.Models;
        using Ext.Net;
        using Ext.Net.MVC;
    
        public class HomeController : System.Web.Mvc.Controller
        {
            public ActionResult Index()
            {
                return View();
            }
        }
    }
    Views/Web.config
    <?xml version="1.0"?>
    
    <configuration>
        <configSections>
            <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
                <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
            </sectionGroup>
        </configSections>
    
        <system.web.webPages.razor>
            <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <pages pageBaseType="System.Web.Mvc.WebViewPage">
                <namespaces>
                    <add namespace="System.Web.Mvc" />
                    <add namespace="System.Web.Mvc.Ajax" />
                    <add namespace="System.Web.Mvc.Html" />
                    <add namespace="System.Web.Optimization" />
                    <add namespace="System.Web.Routing" />
                    <add namespace="Ext.Net" />
                    <add namespace="Ext.Net.MVC" />
                    <add namespace="Core.Models" />
                </namespaces>
            </pages>
        </system.web.webPages.razor>
    
        <appSettings>
            <add key="webpages:Enabled" value="false" />
        </appSettings>
    
        <system.web>
            <httpHandlers>
                <add path="*" verb="*" type="System.Web.HttpNotFoundHandler" />
                <add path="*/ext.axd" verb="*" type="Ext.Net.ResourceHandler" validate="false" />
            </httpHandlers>
            <pages
                validateRequest="false"
                pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
                pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
                userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                <controls>
                    <add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
                </controls>
            </pages>
            <httpModules>
                <add name="DirectRequestModule" type="Ext.Net.DirectRequestModule, Ext.Net" />
            </httpModules>
        </system.web>
    
        <system.webServer>
            <validation validateIntegratedModeConfiguration="false" />
    
            <handlers>
                <remove name="BlockViewHandler" />
                <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
            </handlers>
        </system.webServer>
    </configuration>
    root web.config
    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
        <configSections>
            <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
            <section name="extnet" type="Ext.Net.GlobalConfig" requirePermission="false" />
        </configSections>
        <connectionStrings>
            <add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=RTS;Integrated Security=SSPI" />
        </connectionStrings>
        <appSettings>
            <add key="webpages:Version" value="2.0.0.0" />
            <add key="webpages:Enabled" value="false" />
            <add key="PreserveLoginUrl" value="true" />
            <add key="ClientValidationEnabled" value="true" />
            <add key="UnobtrusiveJavaScriptEnabled" value="true" />
        </appSettings>
        <system.web>
            <compilation debug="true" targetFramework="4.0" />
            <authentication mode="Forms">
                <forms loginUrl="~/Account/Login" timeout="2880" />
            </authentication>
            <pages>
                <namespaces>
                    <add namespace="System.Web.Helpers" />
                    <add namespace="System.Web.Mvc" />
                    <add namespace="System.Web.Mvc.Ajax" />
                    <add namespace="System.Web.Mvc.Html" />
                    <add namespace="System.Web.Optimization" />
                    <add namespace="System.Web.Routing" />
                    <add namespace="System.Web.WebPages" />
                </namespaces>
            </pages>
            <profile defaultProvider="DefaultProfileProvider" automaticSaveEnabled="false" enabled="true" inherits="Core.Common.UserProfile">
                <providers>
                    <clear />
                    <add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
                </providers>
            </profile>
            <membership defaultProvider="DefaultMembershipProvider">
                <providers>
                    <add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
                </providers>
            </membership>
            <roleManager defaultProvider="DefaultRoleProvider">
                <providers>
                    <add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
                </providers>
            </roleManager>
            <sessionState mode="InProc" customProvider="DefaultSessionProvider">
                <providers>
                    <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
                </providers>
            </sessionState>
            <httpHandlers>
                <add path="*/ext.axd" verb="*" type="Ext.Net.ResourceHandler" validate="false" />
            </httpHandlers>
            <httpModules>
                <add name="DirectRequestModule" type="Ext.Net.DirectRequestModule, Ext.Net" />
            </httpModules>
        </system.web>
        <system.webServer>
            <modules runAllManagedModulesForAllRequests="true">
                <add name="DirectRequestModule" preCondition="managedHandler" type="Ext.Net.DirectRequestModule, Ext.Net" />
            </modules>
            <validation validateIntegratedModeConfiguration="false" />
            <handlers>
                <add name="DirectRequestHandler" verb="*" path="*/ext.axd" preCondition="integratedMode" type="Ext.Net.ResourceHandler" />
            </handlers>
        </system.webServer>
        <runtime>
            <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
                <dependentAssembly>
                    <assemblyIdentity name="System.Web.Helpers"
                         publicKeyToken="31bf3856ad364e35" />
                    <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
                </dependentAssembly>
                <dependentAssembly>
                    <assemblyIdentity name="System.Web.Mvc"
                         publicKeyToken="31bf3856ad364e35" />
                    <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="4.0.0.0" />
                </dependentAssembly>
                <dependentAssembly>
                    <assemblyIdentity name="System.Web.WebPages"
                 publicKeyToken="31bf3856ad364e35" />
                    <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
                </dependentAssembly>
                <dependentAssembly>
                    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
                    <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.5.7" />
                </dependentAssembly>
                <dependentAssembly>
                    <assemblyIdentity name="Ext.Net.Utilities" publicKeyToken="2c34ac34702a3c23" />
                    <bindingRedirect oldVersion="0.0.0.0-2.0.0" newVersion="2.0.1" />
                </dependentAssembly>
                <dependentAssembly>
                    <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
                    <bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
                </dependentAssembly>
            </assemblyBinding>
        </runtime>
        <entityFramework>
            <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
        </entityFramework>
        <extnet theme="Gray" />
    </configuration>
    Global.asax
    namespace Core
    {
        using System.Web;
        using System.Web.Mvc;
        using System.Web.Optimization;
        using System.Web.Routing;
    
        public class MvcApplication : System.Web.HttpApplication
        {
            protected void Application_Start()
            {
                AreaRegistration.RegisterAllAreas();
    
                FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
                RouteConfig.RegisterRoutes(RouteTable.Routes);
            }
    
            protected void Application_AuthenticateRequest(object sender, System.EventArgs e)
            {
                string url = HttpContext.Current.Request.FilePath;
    
                if (url.EndsWith("ext.axd"))
                {
                    HttpContext.Current.SkipAuthorization = true;
                }
            }
        }
    }
    RouteConfig.cs
    namespace Core
    {
        using System.Web.Mvc;
        using System.Web.Routing;
    
        public class RouteConfig
        {
            public static void RegisterRoutes(RouteCollection routes)
            {
                routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
                routes.IgnoreRoute("{exclude}/{extnet}/ext.axd");
    
                routes.MapRoute(
                    name: "Default",
                    url: "{controller}/{action}/{id}",
                    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
                );
            }
        }
    }
    Any ideas or thoughts would be greatly appreciated!
    Last edited by markusn; Nov 04, 2012 at 3:29 PM.
  2. #2

    2.1 release?

    Does anybody know if this issue will be addressed in the 2.1 release?

Similar Threads

  1. [CLOSED] [RAZOR] DraggablePanelConfig doesn't have StartDrag in Razor
    By UnifyEducation in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 28, 2012, 2:37 PM
  2. [CLOSED] [Razor] Setup Auto load panel in razor
    By UnifyEducation in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 27, 2012, 10:54 AM
  3. Load PartialViews on Panel
    By Dominik in forum 1.x Help
    Replies: 5
    Last Post: Feb 25, 2011, 9:19 AM
  4. [CLOSED] [1.0] MVC PartialViews and Icons
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Feb 19, 2010, 3:35 PM
  5. [CLOSED] [1.0] MVC PartialViews and styles?
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 14
    Last Post: Feb 14, 2010, 4:12 PM

Tags for this Thread

Posting Permissions