[CLOSED] DirectMethod.Request Problem

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] DirectMethod.Request Problem

    hi, i have a problem with Ext.net.DirecMethod.request . i want to access a directmethod in another page . i tried
    Ext.net.DirectMethod.request('DoSomething',{ url:'~/Pages/default.aspx'})
    . my DoSomething method has [DirectMethod] attribute . but i didn't work. also i tried
    Ext.net.DirectMethod.request('DoSomething',{ url:'default.aspx' , cleanRequest : true})
    but it didn't too. am i missing something ?

    Regards.
    Last edited by Daniil; Oct 28, 2010 at 8:20 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Did you try just
    Ext.net.DirectMethod.request('DoSomething')
    ?

    It should work.

    If the issue persist please provide us with a sample code like the following one.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        [DirectMethod]
        public void TestDirectMethod()
        {
            X.Msg.Alert("DirectMethod", "Hello!").Show();
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:Button runat="server" Text="DirectMethod">
            <Listeners>
                <Click Handler="Ext.net.DirectMethod.request('TestDirectMethod');" />
            </Listeners>
        </ext:Button>
        </form>
    </body>
    </html>
  3. #3
    Hi,

    Well, thereoretically it should works. Just I suggest to use
    type:'load'
    also you can add failure handler to see the problem
    <Click Handler="Ext.net.DirectMethod.request('DoSomething',{url:'Page.aspx', type:'load', failure: function(error){Ext.Msg.alert('Error', error);}})" />
    But IMHO it is bad design to call cross page direct methods. If you have logic which must be shared then you can use webservice (it is more effectively)
  4. #4
    hi vlademir , "type : load" does not solve my problem . also it doesn't show any error. in debuging , result of this call process is undefined. i can't use webservice because i refresh UI in method.
  5. #5
    Hi,

    I just tested it with success.
    Please look at the following example.

    If the issue persist please provide us with a sample code.

    Example Page

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:Button runat="server" Text="Test DirectMethod from another page">
            <Listeners>
                <Click Handler="Ext.net.DirectMethod.request('Test', {url: 'AnotherPage.aspx'});"/>
            </Listeners>
        </ext:Button>
        </form>
    </body>
    </html>
    Example Another Page
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">   
        [DirectMethod]
        public void Test()
        {
            X.Msg.Alert("AnotherPage", "Hello!").Show();
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        </form>
    </body>
    </html>
  6. #6
    Hi,

    i can't use webservice because i refresh UI in method.
    I am not sure what UI can update another (!) page. Can you clarify it?
  7. #7
    ok. i have a page( page1) and it contains two user control (i.e uc1 & uc2).uc1 contains ext grid and some ext controls . i open uc2 in ext window and it contains some ext field controls and a panel to show page2 in iframe . in page2 , user do some crud processes and click save button . after click save button , i want to refresh grid in uc1 and some updates on controls. so

    i have method in page1.

    [DirectMethod]        
            public  void AfterSave()
            {
                 //this method call the uc1's method to update UI.
            }

    in page2 save button click

    parent.Ext.getCmp(parent.document.ctlKuralEditorWindowId).close(); // to close uc2's parent window.
    Ext.net.DirectMethod.request('AfterSave', { url: '~/Pages/Users/Provizyon/ProvizyonKural/default.aspx', type: 'load', failure: function (error) { Ext.Msg.alert('Error', error); } }); // to refresh uc1's grid and control in page1
    as a result AfterSave method isn't called from client side.

    thanks for interest.
  8. #8
    Hi,

    You have to call direct method right context
    parent.Ext.net.DirectMethod.request('AfterSave', { failure: function (error) { Ext.Msg.alert('Error', error); } });
  9. #9
    i tried this , but it didn't solve.
  10. #10
    Hi,

    Could you provide us with a simplified sample code reproducing the issue?

    You can base on the following code which works fine.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:Button runat="server" Text="Test DirectMethod from another page">
            <Listeners>
                <Click Handler="Ext.net.DirectMethod.request('Test', {url: 'AnotherPage.aspx'});"/>
            </Listeners>
        </ext:Button>
        </form>
    </body>
    </html>
    AnotherPage.aspx
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">   
        [DirectMethod]
        public void Test()
        {
            X.Msg.Alert("AnotherPage", "Hello!").Show();
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        </form>
    </body>
    </html>
Page 1 of 2 12 LastLast

Similar Threads

  1. DirectMethod request fails in hosting service
    By chezinho in forum 1.x Help
    Replies: 6
    Last Post: Feb 20, 2012, 9:36 PM
  2. Replies: 7
    Last Post: Nov 29, 2011, 7:07 AM
  3. Replies: 13
    Last Post: May 16, 2011, 1:26 PM
  4. Ext.net.DirectMethod.request MASK
    By sipo in forum 1.x Help
    Replies: 5
    Last Post: May 07, 2010, 5:30 AM
  5. Ext.net.DirectMethod.request PARAMS
    By sipo in forum 1.x Help
    Replies: 0
    Last Post: Apr 15, 2010, 5:06 AM

Posting Permissions