[CLOSED] DirectMethod question - simple string returning as [Object - object]

  1. #1

    [CLOSED] DirectMethod question - simple string returning as [Object - object]

    Hi, I have a simple DirectMethod being called from a javascript function:

          Ext.net.DirectMethods.GetSectorTeam(hidEntityId.getValue(), hidEntityTypeId.getValue(),
                {
                    success: function (result) {
                        alert(result);
                        UpdateStore(gridActivities.getSelectionModel().getSelected().data.ActivityInProgressId, 'SectorTeam', result);
                        cmboSector.setValue(result);
                        hidSectorTeam.setValue(result);
                        storeAnalyst.reload();
                    }
                 });
    Server-Side:
            [DirectMethod]
            public static string GetSectorTeam(int entityid, int entityTypeId)
            {
                String st=string.Empty;
                if ( entityTypeId.Equals(1) )
                {
                    Company c = Company.FetchByID(entityid);
                    st = c.SectorTeam; 
                }
                return st;
            }

    Using the example on #2 in https://examples1.ext.net/#/Events/D...hods/Overview/, I would have thought I would get back a string...
    Am I doing something wrong?
    Last edited by Daniil; Sep 19, 2011 at 6:17 PM. Reason: [CLOSED]
  2. #2
    Please provide test sample
    Here is my test case
    <%@ 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 id="Head1" runat="server">
        <title></title>
    
    
        <script runat="server">
            [DirectMethod]
            public static string GetSectorTeam(int entityid, int entityTypeId)
            {
                return "SectorTeam";
            }
        </script>
    
    
        <script type="text/javascript">
            function callDM() {
                  Ext.net.DirectMethods.GetSectorTeam(1, 2,
                  {
                      success: function(result) {
                          alert(result);              
                      }
                  });
            }
        </script>
    
    
    </head>
    <body>
        <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <ext:Button runat="server" Text="Call direct method" Handler="callDM">
        </ext:Button>
        </form>
    </body>
    </html>
    Can you provide response text from Fiddler or Firebug?

Similar Threads

  1. ServerMapping returning [object Object]
    By DavidS in forum 1.x Help
    Replies: 13
    Last Post: Jun 14, 2011, 6:19 AM
  2. Replies: 4
    Last Post: Feb 01, 2011, 11:54 AM
  3. Replies: 4
    Last Post: Nov 08, 2010, 6:00 AM
  4. [CLOSED] How to get the object from string
    By juane66 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 22, 2010, 8:18 PM
  5. Replies: 4
    Last Post: Apr 12, 2010, 1:01 PM

Posting Permissions