The official release of Ext.NET Mobile is now available. Ext.NET Mobile is an ASP.NET component framework for building Phone and Tablet specific mobile web applications. Read More

UserControlLoader handling events define in User Control

Page 2 of 2 FirstFirst 12
  1. #11
    So, I am getting the same thing, you click on the menu item and you get a thin line which I am assuming is the rendered control. Something is squashing it down... let me figure it out...
  2. #12
    Ok, take out the RenderToForm="true" from the menu item and it displays. So here is the code from a blank project. This shows the original problem of not being able to select the combo in the control, but has the event wired up, which I can not seem to do using the Control Loader.

    ControlLoaderMain.aspx
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="ControlLoaderMain.aspx.vb" Inherits="ControlLoaderMain" %>
    <%@ Register TagPrefix="uc" TagName="QuickSearch" Src="~/ControlLoaderControl.ascx" %>
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        <ext:ResourceManager ID="ResourceManager" runat="server" />
    
        <ext:Window ID="Window1" runat="server" Visible="true" Maximized="true" Padding="5" Resizable="true" MinHeight="700" MinWidth="500" Closable="false">
            <TopBar>
                <ext:Toolbar ID="Toolbar1" runat="server">
                    <Items>
    
                        <ext:Button ID="QuickLaunchReport" runat="server" Text="This does not work" >
                            <Menu>
                                <ext:Menu ID="QuickLaunchReportMenu" runat="server"  Width="450" ShowSeparator="false">
                                    <Items>
                                        <ext:Panel runat="server" Height="50" Border="true">
                                            <Content>
                                                <uc:QuickSearch ID="QuickSearch" runat="server" />
                                            </Content>
                                        </ext:Panel>
                                    </Items>
                                </ext:Menu>
                            </Menu>
                        </ext:Button>
    
                     </Items>
                </ext:Toolbar>
            </TopBar>
        </ext:Window>    
        </div>
        </form>
    </body>
    </html>
    ControlLoaderMain.aspx.vb
    
    Partial Class ControlLoaderMain
        Inherits System.Web.UI.Page
        Private Sub QuickSearch_Selected(sender As Object, e As ControlLoaderControl.QuickSearchEventArgs) Handles QuickSearch.Selected
    
            Ext.Net.X.AddScript("alert('test');")
        End Sub
    End Class
    ControlLoaderControl.ascx
    <%@ Control Language="VB" AutoEventWireup="false" CodeFile="ControlLoaderControl.ascx.vb" Inherits="ControlLoaderControl" %>
    
    <ext:Panel ID="outControl" runat="server" Height="100" Layout="FitLayout">
        <Items>
            <ext:ComboBox 
                ID="Results" 
                      runat="server"
                    FieldLabel="Select a single item"
                    DisplayField="name"
                    Width="320"
                    LabelWidth="130"
                    QueryMode="Local"
                    TypeAhead="true"        >
                <Store>
                    <ext:Store ID="Store1" runat="server">
                        <Model>
                            <ext:Model runat="server" IDProperty="Value">
                                <Fields>
                                    <ext:ModelField Name="Text" />
                                    <ext:ModelField Name="Value" />
                                </Fields>
                            </ext:Model>
                        </Model>
                    </ext:Store>
                </Store>
                <Items>
                    <ext:ListItem Text="TestingText1" Value="1" />
                    <ext:ListItem Text="Text" Value="2" />
                    <ext:ListItem Text="Text3" Value="3" />
                </Items>
                <DirectEvents>
                    <Select OnEvent="Results_Select">
                        <EventMask ShowMask="true" Target="Page" />
                        <ExtraParams>
                            <ext:Parameter Name="Key" Value="testing" Mode="Raw" />
                        </ExtraParams>
                    </Select>
                </DirectEvents>
             </ext:ComboBox>
        </Items>
    </ext:Panel>
    ControlLoaderControl.ascx.vb
    
    Partial Class ControlLoaderControl
        Inherits System.Web.UI.UserControl
        Public Event Selected As EventHandler
    
        Public Class QuickSearchEventArgs
            Inherits Ext.Net.DirectEventArgs
    
            Public SelectedEntity As String
    
            Public Sub New(extraParams As Ext.Net.ParameterCollection)
                MyBase.New(extraParams)
            End Sub
    
        End Class
    
        Public Sub Results_Select(ByVal sender As Object, ByVal e As Ext.Net.DirectEventArgs)
            Dim params As New Ext.Net.ParameterCollection()
            params.Add(New Ext.Net.Parameter("SameWindow", True))
            Dim args As New QuickSearchEventArgs(params) With {
                        .SelectedEntity = "x"
                        }
            RaiseEvent Selected(Me, args)
        End Sub
    End Class
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Code behind content handling (from client events)
    By fabricio.murta in forum 2.x Help
    Replies: 5
    Last Post: Oct 22, 2014, 7:26 AM
  2. Replies: 1
    Last Post: Sep 28, 2014, 8:36 AM
  3. Replies: 3
    Last Post: Sep 05, 2013, 9:18 AM
  4. Replies: 1
    Last Post: Jan 28, 2013, 6:26 AM
  5. [CLOSED] Direct events in user control
    By tiramisu in forum 1.x Premium Help
    Replies: 8
    Last Post: Dec 13, 2010, 12:34 PM

Posting Permissions

Subscribe now to get the latest Ext.NET happenings in our newsletter.