Jan 19, 2011, 10:35 AM
loading user control on desktop shortcut click
I have a large application with desktop interface , every desktop icon show a window containing a user control . all user controls are loaded in page load ,that produces a slow application start. so i want to load the user control only when the user clicks the desktop shortcut ( not at the form load) . in other words i am not able to add direct event to desktop shortcut icon or desktopmodule.
I tried the following code but it gives me error
I tried the following code but it gives me error
Server Error in '/' Application.
-------------------------------------------------------------------------------
The control with ID 'tLaunch' not found
-------------------------------------------------------------------------------
The control with ID 'tLaunch' not found
Imports Ext.Net
Public Class _Default
Inherits System.Web.UI.Page
Private Sub _Default_LoadComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadComplete
CreateNewWindow(parameters)
End Sub
Sub CreateNewWindow(some parametes)
Dim Win As DesktopWindow = New DesktopWindow()
With Win
.ID = WindowID
.Title = WindowTitle
.Page = Me
End With
MainDesktop.Controls.Add(Win)
Dim ModuleID As String = "mdl"
Dim m As DesktopModule = New DesktopModule()
With m
.ModuleID = ModuleID
.WindowID = WindowID
.Launcher.Text = MainMenuTitle
.Launcher.Icon = MainMenuIcon
.Launcher.ID = "tLaunch"
.Launcher.DirectEvents.Click.ExtraParams.Add(New Ext.Net.Parameter("ControlPath", "~/Registration.ascx"))
.Launcher.DirectEvents.Click.ExtraParams.Add(New Ext.Net.Parameter("WindowID", "Registration"))
AddHandler .Launcher.DirectEvents.Click.Event, AddressOf LoadWindowControl
End With
MainDesktop.Modules.Add(m)
End Sub
<Ext.Net.DirectMethod()> _
Sub LoadWindowControl(ByVal s As Object, ByVal e As DirectEventArgs)
Dim cont As Control = LoadControl(e.ExtraParams("ControlPath"))
CType(FindControl(e.ExtraParams("WindowID")), DesktopWindow).ContentControls.Add(cont)
End Sub
End Class