0

i wanto to start use a Ext.Net desktop (i use it as "normal page" for other application).

i want to know the best approach of initialization desktop from database data. my actual approach is: 1. start with "minimal" desktop page (start menu ecc...) without any modules; 2. read data from database (based on same parameters) and create dynamic modules (i think with DesktopModuleProxy) whit userc control (ex i save path/title/etc... of usercontrol in database); 3. create usercontrol and render it in desktop

i start with this example: http://examples.ext.net/#/Desktop/Introduction/Overview/

method AddNewModule() works only if there is a submit (ex with a launcher), but it doesn't works from Page_Load event and i have this javascript error:

"Cannot read property 'length' of undefined" in ext.axd:93

maybe i use wrong lifecycle page?

finally maybe i use a webform instead usercontrol, but i have same case where i must use usercontrol...

thanks!

.aspx FILE

<ext:Desktop ID="Desktop1" runat="server">            
        <StartMenu Title="Ext.Net Desktop" Icon="Application" Height="300">
            <ToolConfig>
                <ext:Toolbar ID="Toolbar1" runat="server" Width="100">
                    <Items>
                        <ext:Button ID="Button1" runat="server" Text="Settings" Icon="Cog" />
                        <ext:Button ID="Button2" runat="server" Text="Logout" Icon="Key">
                            <DirectEvents>
                                <Click OnEvent="Logout_Click">
                                    <EventMask ShowMask="true" Msg="Ciao..." MinDelay="1000" />
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                    </Items>
                </ext:Toolbar>
            </ToolConfig>
        </StartMenu>

        <TaskBar TrayWidth="100">
            <QuickStart>
                <ext:Toolbar ID="Toolbar2" runat="server">
                    <Items>
                        <ext:Button ID="Button3" runat="server" Handler="tile" Icon="ApplicationTileVertical">
                            <QTipCfg Text="Tile windows" />
                        </ext:Button>

                        <ext:Button ID="Button4" runat="server" Handler="cascade" Icon="ApplicationCascade">
                            <QTipCfg Text="Cascade windows" />
                        </ext:Button>
                    </Items>
                </ext:Toolbar>
            </QuickStart>

            <Tray>
                <ext:Toolbar ID="Toolbar3" runat="server">
                    <Items>
                        <ext:ToolbarFill ID="ToolbarFill1" runat="server" />
                    </Items>
                </ext:Toolbar>
            </Tray>
        </TaskBar>
        <DirectEvents>
            <Ready OnEvent="loadTest"></Ready>

        </DirectEvents>

    </ext:Desktop>

.cs file

    [DirectMethod]
    public void loadTest(object sender, DirectEventArgs e)
    {
            DesktopModuleProxy control =     Ext.Net.Utilities.ControlUtils.FindControl<Ext.Net.DesktopModuleProxy>    (this.LoadControl("/user/default.ascx"));
            control.RegisterModule();
    }

Error by chrome: Uncaught TypeError: Cannot read property 'app' of undefined Default.aspx:31 Uncaught TypeError: Cannot read property 'length' of undefined ext.axd:93

these is a "last version" of my various tests. if i invoke same method "loadTest" by button (like the original example) it works. User control has only 1 label with datetime.

thanks!

maurox
  • 1,254
  • 1
  • 19
  • 33
  • I think you're going to have to post a simplified, .aspx code sample demonstrating how to reproduce. I tried the sample you linked to above and it appears to work correctly. – geoffrey.mcgill Oct 31 '12 at 15:48
  • yes, of course the example works great. maybe i made a mistake, but my question is little different. i want to know if my approach is good or not, if there is a "best practice" to follow when developer want to create a web-desktop application... – maurox Nov 06 '12 at 09:41

1 Answers1

0

You can use Ext.onReady and ext:ResourcePlaceHolder with DirectMethod on server, like this:

<ext:ResourcePlaceHolder runat="server" Mode="Script" />
<script type="text/javascript">
    Ext.onReady(function () {
        App.direct.YourDirectMethod();
    });
</script>
nta189
  • 1