[CLOSED] Usercontrol, DirectMethod, Object --> Get Value

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] Usercontrol, DirectMethod, Object --> Get Value

    Hi Guys,

    Working on a large desktop project and looking for an answer. Check following files.

    I would like to get the value of Textfield tfTest (Test2.ascx) to be shown in codebehind when using a DirectMethod. But I can't. Can you explain why and what can I do to achieve my goal. I don't get an error. Just no value..

    Default.aspx
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Iwise.DefaultTest" %>
    <%@ Register Src="Test1.ascx" TagPrefix="mod" TagName="Test1" %>
    <%@ Register Src="Test2.ascx" TagPrefix="mod" TagName="Test2" %>
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>I-Wise</title>
    </head>
    <body>
    <ext:ResourceManager runat="server" ID="rsmTestIwise"/>
        <ext:Desktop ID="dtIwiseTest" runat="server">
            <StartMenu Title="Keuze menu" Icon="Application" Height="500">
                <ToolConfig>
                    <ext:Toolbar runat="server" Width="110">
                        <Items>
                            <ext:Button runat="server" Text="Settings" Icon="Cog" />
                        </Items>
                    </ext:Toolbar>
                </ToolConfig>
                <MenuItems>
                    <ext:MenuItem ID="mnuTestDM" runat="server" Text="Open Test1" Icon="Car">
                         <Listeners>
                            <Click Handler="App.dtIwiseTest.getModule('modTest1').createWindow();"/>
                         </Listeners>
                    </ext:MenuItem>
                </MenuItems>
            </StartMenu>
        </ext:Desktop>
        <%--Modules from User controls--%>
        <mod:Test1 ID="ucTest1" runat="server"/>
        <mod:Test2 ID="ucTest2" runat="server"/>
    </body>
    </html>
    Default.aspx.cs
    using System;
    using System.Web.UI;
    using Ext.Net;
    
    
    namespace Iwise
    {
        public partial class DefaultTest : Page
        {
    
    
            [DirectMethod(ShowMask = true)]
            public void ShowWindow(string name)
            {
               LoadControl($"{name}.ascx");
            }
        }
    }
    Test1.ascx
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Test1.ascx.cs" Inherits="iWise3.Test.Test1" %>
    <ext:DesktopModuleProxy runat="server">
        <Module ModuleID="modTest1">
            <Window>
                <ext:Window runat="server"
                    Icon="CarAdd"
                    Width="450"
                    Height="400"
                    Layout="Fit"
                    Title="Overzicht ingevoerde kilometerstanden"
                    Resizable="False"
                    Minimizable="False"
                    ID="winTest">
                    <TopBar>
                        <ext:Toolbar runat="server">
                            <Items>
                                <ext:Button runat="server" ID="btnToevoegenKmStandTest" Text="Open Test2" Icon="Add">
                                    <Listeners>
                                        <Click Handler="App.dtIwiseTest.getModule('modTest2').createWindow();" />
                                    </Listeners>
                                </ext:Button>
                            </Items>
                        </ext:Toolbar>
                    </TopBar>
                    <Items>
                    </Items>
                </ext:Window>
            </Window>
        </Module>
    </ext:DesktopModuleProxy>
    (.cs = empty code file)

    Test2.ascx
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Test2.ascx.cs" Inherits="iWise3.Test.Test2" %>
    <ext:DesktopModuleProxy runat="server">
        <Module ModuleID="modTest2">
            <Window>
                <ext:Window runat="server"
                    Icon="Table"
                    Width="400"
                    Height="260"
                    Layout="Fit"
                    Title="Invoer kilometerstand"
                    Modal="True"
                    Resizable="False"
                    Minimizable="False"
                    ID="winTest2">
                    <Items>
                        <ext:FormPanel
                            runat="server"
                            Frame="true"
                            Border="false"
                            BodyPadding="10"
                            DefaultAnchor="100%"
                            ID="frmTest1">
                            <FieldDefaults
                                LabelSeparator=" "
                                LabelAlign="Top"
                                LabelWidth="100"
                                LabelStyle="font-weight:bold;font-size:smaller;" />
                            <Defaults>
                                <ext:Parameter Name="margin" Value="0 0 10 0" Mode="Value" />
                            </Defaults>
                            <Items>
                                <ext:TextField
                                    runat="server"
                                    Flex="1"
                                    EmptyText="Add Value"
                                    HideTrigger="True"
                                    LabelAlign="Top"
                                    FieldLabel="Kilometer stand"
                                    ID="tfTest" 
                                    AllowBlank="False"
                                    />
                            </Items>
                            <DockedItems>
                                    <ext:Toolbar runat="server" Dock="Bottom">
                                        <Items>
                                            <ext:ToolbarFill runat="server"/>
                                            <ext:Button runat="server" Icon="Exclamation" text="Try to get value field in DM">
                                                <Listeners>
                                                    <Click Handler="DMKSI.ucTest2.TestObject();"/>
                                                </Listeners>
                                            </ext:Button>
                                        </Items>
                                    </ext:Toolbar>
                                </DockedItems>
                        </ext:FormPanel>
                    </Items>
                </ext:Window>
            </Window>
        </Module>
    </ext:DesktopModuleProxy>
    Test2.ascx.cs
    [
    using System.Diagnostics;
    using Ext.Net;
    
    
    namespace iWise3.Test
    { 
        public partial class Test2 : System.Web.UI.UserControl
        {
            [DirectMethod(Namespace = "DMKSI")]
            public void TestObject()
            {
                string number = tfTest.Text;
                Debug.WriteLine($"Value: {number}");
            }
        }
    }



    Martin
    Last edited by fabricio.murta; Jul 22, 2016 at 9:08 PM.

Similar Threads

  1. Triggering [DirectMethod] in a UserControl
    By geoffrey.mcgill in forum Examples and Extras
    Replies: 0
    Last Post: Dec 18, 2013, 3:55 AM
  2. Replies: 4
    Last Post: Dec 19, 2012, 9:58 AM
  3. Replies: 4
    Last Post: Oct 27, 2012, 10:59 AM
  4. Replies: 1
    Last Post: Sep 13, 2011, 5:19 PM
  5. [CLOSED] [1.0] DirectMethod - Page . UserControl . UserControl
    By Patrick in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Feb 25, 2010, 9:33 AM

Posting Permissions