[CLOSED] DirectMethod not firing

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] DirectMethod not firing

    based on this example https://examples1.ext.net/#/Events/D...hods/Overview/ I did:

    This part is located inside of void Page_Load

                                                new Ext.Net.ListView {
                                                    ID = this.ID + "_DocuRefListView",
                                                    EmptyText= Labels.GetLabel("@SYS111699"),
                                                    StoreID = DocuRefStore.ClientID,
                                                    Selectable = true,
                                                    HideHeaders = true,
                                                    ColumnSort = false,
                                                    Listeners = {
                                                        Click = {
                                                            Handler="Ext.net.DirectMethods.TestDirect();"
                                                        }
                                                    },
                                                    Columns = {
                                                        new ListViewColumn { 
                                                            Header = Labels.GetLabel("@SYS22563"), 
                                                            DataIndex = "Name",
                                                            Template = "{Name}"
                                                        },
                                                        new ListViewColumn { 
                                                            Header = Labels.GetLabel("@SYS21858"),
                                                            DataIndex = "createdDateTime",
                                                            Template = @"{createdDateTime:date(""m-d-Y H:i"")}"
                                                        }
                                                    }
                                                }
    and

        [DirectMethod]
        public void TestDirect()
        {
            X.Msg.Alert("QQ","ZZ").Show();
        }
    and nothing is showing after click. I look on Firebug but nothing happened on click. Click is fired because
    Fn="alert('QQ')"
    is showing.

    my .ascx file have declaration like this:
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
    <%@ Import Namespace="System.Collections.Generic" %>
    
    
        <ext:ResourceManager ID="ExtResourceManager1" runat="server" 
        CleanResourceUrl="True" GZip="True" ScriptMode="Release" SourceFormatting="False" DebugConsole="Firebug" />
    Last edited by Daniil; Mar 01, 2011 at 8:29 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Please clarify where are the following things defined?

    1. ListView
    2. DirectMethod

    I mean: in main .aspx page or in .ascx.
  3. #3
    both in ascx.cs (codebehind webpart)
  4. #4
    Then it should look like this
    #{DirectMethods}.TestDirect();
    See also
    https://examples1.ext.net/#/Events/D.../UserControls/
  5. #5
    still the same, no action at all, no request is visible in firebug.


    my codefile is defined like this:

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="xplTaskTrackerGrid.ascx.cs" Inherits="xplTaskTrackerGrid" %>
    next my webpart class is

    public partial class xplTaskTrackerGrid : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
           //here is listview created (but not rendered or show), Render and Show is called later on click.
        }  
    
    
    (....)
    
        [DirectMethod]
        public void TestDirect()
        {
            X.Msg.Alert("QQ", "ZZ").Show();
        }
    
    }
    is it ok ?
  6. #6
    How does the Click's Handler look now?
  7. #7
                                        new Ext.Net.Panel {
                                            Layout = "Fit",
                                            Title = Labels.GetLabel("@SYS54806"),
                                            Items = {
                                                new Ext.Net.ListView {
                                                    ID = this.ID + "_DocuRefListView",
                                                    EmptyText= Labels.GetLabel("@SYS111699"),
                                                    StoreID = DocuRefStore.ClientID,
                                                    Selectable = true,
                                                    HideHeaders = true,
                                                    ColumnSort = false,
                                                    Listeners = {
                                                        Click = {
                                                            Handler="#{DirectMethods}.TestDirect();"
                                                        }
                                                    },
                                                    Columns = {
                                                        new ListViewColumn { 
                                                            Header = Labels.GetLabel("@SYS22563"), 
                                                            DataIndex = "Name",
                                                            Template = "{Name}"
                                                        },
                                                        new ListViewColumn { 
                                                            Header = Labels.GetLabel("@SYS21858"),
                                                            DataIndex = "createdDateTime",
                                                            Template = @"{createdDateTime:date(""m-d-Y H:i"")}"
                                                        }
                                                    }
                                                }
                                            }
                                        },

        [DirectMethod]
        public void TestDirect()
        {
            X.Msg.Alert("QQ", "ZZ").Show();
        }
  8. #8
    It looks like {DirectMethods} doesn't work when a control is dynamically rendered. I didn't know it.

    Well, please use the following attribute for a user control class:
    [DirectMethodProxyID(IDMode = DirectMethodProxyIDMode.None)]
    and
    Ext.net.DirectMethods.Test();
    or

    [DirectMethodProxyID(IDMode = DirectMethodProxyIDMode.Alias, Alias = "UC")]
    and
    Handler = "Ext.net.DirectMethods.UC.Test();"
  9. #9
    Thanks now it's working fine. Is it a bug or a feature ?
  10. #10
    It's a feature. I just was wrong when I thought that it should work with #{DirectMethods} syntax.
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] Directmethod not firing in deployment server on safari
    By egvt in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Apr 26, 2012, 10:59 PM
  2. [CLOSED] Difference between DirectMethod , DirectEvent, Static DirectMethod
    By syllabusarq in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 01, 2011, 11:37 AM
  3. [CLOSED] Button event firing twice?
    By geodan in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Aug 18, 2010, 7:03 PM
  4. [CLOSED] OnItemSelected and OnValueChanged are not firing
    By LeeTheGreek in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Oct 20, 2009, 1:45 PM
  5. [CLOSED] OnSubmitData Not Firing
    By LeeTheGreek in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: May 18, 2009, 10:23 AM

Tags for this Thread

Posting Permissions