how to call direct method in asp.net mvc3

  1. #1

    how to call direct method in asp.net mvc3

    Direct method appears to be cool feature but i am not able to call in asp.net MVC3

    i use like this in my controller i have declared a method like this
    [DirectMethod]
            public double? GetData(int id=0, int id3=0) 
            {
    
             
    
                double? amount = DB.GetMthod(id,id3);
    
                return amount; 
    
    
            }
    and in my view i am calling like this
    Ext.net.DirectMethods.GetData(1,3)
    but its never being called can any body tell me does ext2.0 supports direct methods in asp.net mvc??
    if its not possible then also tell me how can i call a store with number field i have scenario on selection of a combox box i need to fetch data from database to show in numberfield how can i attach store with numberfield i was thinking to achieve it using direct method any idea how can i do it???
    Last edited by Daniil; Mar 16, 2012 at 9:04 AM. Reason: Please use [CODE] tags
  2. #2
    Hi,

    Where is this DirectMethod defined? If within a common aspx view, a DirectMethod should work.

    Just change DirectMethods namespace to "App.direct".

    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.MVC v2 Example</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:Button runat="server" Text="DirectMethod">
            <Listeners>
                <Click Handler="App.direct.TestDirectMethod();" />
            </Listeners>
        </ext:Button>
    </body>
    </html>
    Though I would suggest to use a controller action.
    http://forums.ext.net/showthread.php...ll=1#post72560

    Calling a controller action in JavaScript will look the same as calling a WebService:
    https://examples2.ext.net/#/Events/D...ds/WebService/

Similar Threads

  1. [CLOSED] Output Cache issue with Direct Method / Direct Event
    By amitpareek in forum 1.x Legacy Premium Help
    Replies: 18
    Last Post: Mar 01, 2013, 5:03 AM
  2. [CLOSED] MVC - Direct Method
    By adelaney in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 19, 2012, 9:43 PM
  3. [CLOSED] Can I use Response object in a direct method call?
    By feanor91 in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 12, 2012, 11:50 AM
  4. Direct method and direct event over SSL?
    By dimitar in forum 1.x Help
    Replies: 0
    Last Post: Oct 08, 2011, 8:09 PM
  5. method call
    By mono in forum 1.x Help
    Replies: 1
    Last Post: Mar 09, 2009, 6:46 AM

Tags for this Thread

Posting Permissions