The error "Ext.net.DirectMethods.MyFucntion is not a function"

  1. #1

    The error "Ext.net.DirectMethods.MyFucntion is not a function"

    I wonder why the first block of the code works good, but the second is not!

     <ext:Button runat="server" ID="btnCalculateCoordinates" >
       <Listeners>
             <Click Handler="#{DirectMethods}.CalculateCoordinates()"></Click>
         </Listeners>
     </ext:Button>
    
    
    //code behind
    [DirectMethod]
    public void CalculateCoordinates() { //............. }




    In the this case the furebug says Ext.net.DirectMethods.CalculateCoordinates is not a function
    <script type="text/javascript">
    function calculateCoordinates() {
            Ext.net.DirectMethods.CalculateCoordinates();
    }
     <ext:Button runat="server" ID="btnCalculateCoordinates" >
       <Listeners>
             <Click Fn="calculateCoordinates"></Click>
         </Listeners>
     </ext:Button>
    
    
    //code behind
    [DirectMethod]
    public void CalculateCoordinates() { //............. }
  2. #2
    Where DirectMethod is defined? UserControl or master page?
    Vladimir Shcheglov
    Sr. Developer
  3. #3
    It is defined in the UserControl. That UserControl is contained in the Page, which is contained in the MasterPage.
  4. #4
    If direct method is placed inside user control then ClientID of user control must be added to direct method
    Ext.net.DirectMethods.ClientIDOfUserControl.MyMethod();
    Or you can add [DirectMethodProxyID] attribute for user control to prevent ClientID prefix or add own prefix
    See http://examples1.ext.net/#/Events/Di...thods/ID_Mode/
    Vladimir Shcheglov
    Sr. Developer
  5. #5
    Thanks, it work!
    function calculateCoordinates() {
            Ext.net.DirectMethods.<%=ClientID%>.CalculateCoordinates();
        }

Similar Threads

  1. Replies: 5
    Last Post: Jul 19, 2012, 12:09 PM
  2. Replies: 5
    Last Post: May 02, 2012, 5:37 PM
  3. Replies: 4
    Last Post: Oct 11, 2011, 2:42 AM
  4. Replies: 2
    Last Post: Jun 26, 2011, 1:59 AM
  5. Replies: 8
    Last Post: May 30, 2011, 5:55 PM

Tags for this Thread

Posting Permissions