[CLOSED] Pass object to AjaxMethod

  1. #1

    [CLOSED] Pass object to AjaxMethod

    How can I pass a dictionary(of string, string) to an AjaxMethod? Or a complex object? What are the possible types for parameters an AjaxMethod can accept?

    Sample code:
        <form id="form1" runat="server">
    
        <script runat="server">
       
            <AjaxMethod(Type:=AjaxEventType.Load)> _
            Public Shared Function Test(ByVal aParams As Dictionary(Of String, String)) As String
                Return aParams.Item("param1")
            End Function
        
        </script>
    
        <script type="text/javascript">
            function test() {
                Coolite.AjaxMethods.Test({ 
                        param1: 'success', 
                        param2: 'success' 
                    }, {
                        success: function(result) {
                            Ext.Msg.alert('Status', result);
                    }
                }
                );
            }
        </script>
    
        <ext:ScriptManager ID="ScriptManager2" runat="server" IDMode="Static">
        </ext:ScriptManager>
        <ext:Button runat="server" ID="btnTest" Handler="test" Text="Test">
        </ext:Button>
        </form>
  2. #2

    RE: [CLOSED] Pass object to AjaxMethod

    Did some searching and found a post with the answer. I had to Ext.encode the parameter on the client side. It would be great if an example of sending back complex object is included in the Examples Explorer. Thanks!!
  3. #3

    RE: [CLOSED] Pass object to AjaxMethod

    jchau, Can you link to the post with the answer?

  4. #4

    RE: [CLOSED] Pass object to AjaxMethod

  5. #5
    Would someone mind fixing the link above? It goes to the wrong post...

    Thanks
  6. #6
    I am afraid I cannot fix that link. Here is another link with an example, see the last argument of the DirectMethod call.
    http://forums.ext.net/showthread.php...ll=1#post57093

Similar Threads

  1. pass object to web service with loader
    By Taz in forum 2.x Help
    Replies: 0
    Last Post: Aug 03, 2012, 11:08 AM
  2. How to pass object as a parameter?
    By diegovbs in forum 1.x Help
    Replies: 1
    Last Post: Jan 04, 2011, 5:53 PM
  3. [CLOSED] To pass an Array using ajaxmethod
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 31, 2009, 7:58 AM
  4. Send complex object to AjaxMethod
    By glenh in forum 1.x Help
    Replies: 2
    Last Post: Aug 13, 2009, 10:01 AM
  5. Add new object through AjaxMethod
    By xumix in forum 1.x Help
    Replies: 5
    Last Post: Mar 12, 2009, 11:10 AM

Posting Permissions