Ext.NET DirectMethod throws “… has no method” error

  1. #1
    I am trying to add a listener to my text fields when I focus. The code is as follows:

      
          foreach (Component comp in leftComponenets)
            {
                //((TextField)comp).AddListener("Click", "Ext.net.DirectMethods.clickOnObject()");
                if (comp is TextField)
                {
                    ((TextField)comp).Listeners.Focus.Handler = "Ext.net.DirectMethods.clickOnObject();";
                }
            }
    It is being assigned the following method:

     
        [DirectMethod]
        public void clickOnObject()
        {
            Response.Write("hwerlkjasdf;ljasdf");
        }
    However, when I focus on the text field, I am getting the following error in Chrome:

    Object #<Object> has no method 'clickOnObject'
    I have tried a number of different methods including putting the code inline into the front end XML but I still have the same problem. It seems to me that the linker doesn't get assigned properly into Ext.net.DirectMethods object. I am not sure what i am doing wrong. Is it because I am using the back end to assign the listener?

    Any help is greatly appreciated!
  2. #2
    This question was cross posted on StackOverflow, see

    http://stackoverflow.com/questions/1...-method-error/

    The answer provided on StackOverflow was:

    With a [DirectMethod] you cannot write directly to the Response stream. Based on the code sample you provided above, if you change it show a Notification window it should work.

    Example

    X.Msg.Notify("Message", "hwerlkjasdf;ljasdf").Show();
    Geoffrey McGill
    Founder & CEO

Similar Threads

  1. Replies: 6
    Last Post: Jul 02, 2012, 2:17 PM
  2. [CLOSED] Collapse panel throws error
    By machinableed in forum 2.x Premium Help
    Replies: 1
    Last Post: Jun 05, 2012, 4:29 AM
  3. Replies: 8
    Last Post: Feb 23, 2012, 2:52 PM
  4. Replies: 2
    Last Post: Jan 13, 2012, 5:12 AM
  5. [CLOSED] UpdateSelection() throws javascript error
    By sadaf in forum 1.x Premium Help
    Replies: 3
    Last Post: Mar 07, 2011, 12:14 PM

Tags for this Thread

Posting Permissions