[CLOSED] How add Modules in Web Desktop

  1. #1

    [CLOSED] How add Modules in Web Desktop

    this is asp.net source :

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <%@ Register Src="modules/AccordionWindow.ascx" TagPrefix="mod" TagName="AccordionWindow" %>
    <%@ Register Src="modules/GridWindow.ascx" TagPrefix="mod" TagName="GridWindow" %>
    <%@ Register Src="modules/WhatsNew.ascx" TagPrefix="mod" TagName="WhatsNew" %>
    <%@ Register Src="modules/SystemStatus.ascx" TagPrefix="mod" TagName="SystemStatus" %>
    
    .
    .
    .
    <html>
    <body>
    .
    .
    .
            <mod:AccordionWindow runat="server" />
            <mod:GridWindow runat="server" />
            <mod:SystemStatus runat="server" />
            <mod:WhatsNew runat="server" />
    .
    .
    .
    </body>
    </html>
    I want to implement as this source in MVC.
    I want to get the sample source.
    Last edited by Daniil; May 02, 2012 at 9:51 PM. Reason: Please use [CODE] tags, [CLOSED]
  2. #2
    Hi,

    Well, generally, the same. Please investigate the example.

    Example View
    <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <%@ Register Src ="~/Views/Test/AccordionWindow.ascx" TagName="Partial" TagPrefix="mvc" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net.MVC v2 Example</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        
        <ext:Desktop ID="Desktop1" runat="server">
            <Modules>
                <ext:DesktopModule ModuleID="DesktopModule1" AutoRun="true">
                    <Window>
                        <ext:Window 
                            runat="server" 
                            Title="Greeting" 
                            Html="Go to Start menu add modules dynamically" />
                    </Window>
                </ext:DesktopModule>
            </Modules>
            <StartMenu runat="server" Height="200">
                <MenuItems>
                    <ext:MenuItem runat="server" Text="Add module">
                        <DirectEvents>
                            <Click Url="/Test/AddModule1" Before="this.disable();">
                                <ExtraParams>
                                    <ext:Parameter Name="desktopId" Value="Desktop1" Mode="Value" />
                                </ExtraParams>
                            </Click>
                        </DirectEvents>
                    </ext:MenuItem>
                    <ext:MenuItem runat="server" Text="Add module from ASCX">
                        <DirectEvents>
                            <Click Url="/Test/AddModule2" Before="this.disable();">
                                <ExtraParams>
                                    <ext:Parameter Name="desktopId" Value="Desktop1" Mode="Value" />
                                </ExtraParams>
                            </Click>
                        </DirectEvents>
                    </ext:MenuItem>
                </MenuItems>
            </StartMenu>
        </ext:Desktop>
    
        <mvc:Partial runat="server" />
    </body>
    </html>
    Example Controller
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    using Controller = System.Web.Mvc.Controller;
    using Ext.Net;
    using Ext.Net.MVC;
    
    namespace Work2MVC.Controllers
    {
        public class TestController : Controller
        {
            public ActionResult TestDesktop()
            {
                return View();
            }
    
            public ActionResult AddModule1(string desktopId)
            {
                AjaxResult r = new AjaxResult();
    
                Desktop desktop = X.GetCmp<Desktop>(desktopId);
    
                var m = new DesktopModule
                {
                    ModuleID = "dyn-mod",
                    Shortcut = new DesktopShortcut
                    {
                        Name = "Dynamic Module"
                    },
    
                    Launcher = new Ext.Net.MenuItem
                    {
                        Text = "Dynamic module"
                    },
    
                    Window = 
                    {
                        new Window 
                        { 
                            Title = "Dynamic Window",
                            Width = 300,
                            Height = 300,
                            DefaultRenderTo = Ext.Net.DefaultRenderTo.Form,
                            Icon = Icon.ApplicationAdd                    
                        }
                    },
    
                    AutoRun = true
                };
    
                desktop.AddModule(m);
    
                return r;
            }
    
            public ActionResult AddModule2(string desktopId)
            {
                AjaxResult r = new AjaxResult();
    
                Desktop desktop = X.GetCmp<Desktop>(desktopId);
    
                var control = Ext.Net.Utilities.ControlUtils.FindControl<Ext.Net.DesktopModuleProxy>(new ViewUserControl().LoadControl("~/Views/Test/WhatsNew.ascx"));
                control.RegisterModule();        
    
                return r;
            }
        }
    }
    WhatsNew.ascx and AccordionWindow.ascx are the same as in the example.
    https://examples2.ext.net/#/Desktop/...tion/Overview/
    Last edited by Daniil; Nov 13, 2012 at 4:44 AM.

Similar Threads

  1. Replies: 0
    Last Post: Jun 15, 2012, 9:06 AM
  2. [CLOSED] Center desktop shortcuts on desktop
    By CarWise in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 15, 2011, 6:49 AM
  3. [CLOSED] Using UserControls as modules and load on demand
    By smart+ in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jul 22, 2010, 6:25 PM
  4. Refreshing desktop control from desktop window
    By AnilVelamuri in forum 1.x Help
    Replies: 0
    Last Post: May 26, 2010, 7:53 AM
  5. How to hide modules from startmenu in ?
    By presariov2013ap in forum 1.x Help
    Replies: 1
    Last Post: Mar 10, 2009, 4:19 AM

Tags for this Thread

Posting Permissions