Direct Method is not firing

  1. #1

    Direct Method is not firing

    Hi I want to change a lable text from a server side code which is called from a client side using DirectMethod here is the code


    <script runat="server">
    [DirectMethod]
    public void SetTimeStamp()
    {
    this.lblAmida.Text = string.Concat("Server Time: ", DateTime.Now.ToLongTimeString());
    }
    </script>



    <ext:Label runat="server" ID="lblAmida"></ext:Label>
    <ext:Button ID="Button5" runat="server" Text="Click Me" Icon="Lightning">
    <Listeners>
    <Click Handler="App.direct.SetTimeStamp();" />
    </Listeners>
    </ext:Button>



    Thank You
    Last edited by amida; Mar 25, 2013 at 6:08 AM.
  2. #2
    Are you getting any sort of JavaScript error in your browser's console like function not defined or something?
    Your example and description does not give much to go on...

    If this code is within a user control (ascx), you need to use #{DirectMethods} instead of App.direct
    See this: https://examples2.ext.net/#/Events/D.../UserControls/
    <Click Handler="#{DirectMethods}.SetTimeStamp();" />
    Also if you have changed your DirectMethodNamespace, you need to use it instead:
    <ext:ResourceManager runat="server" DirectMethodNamespace="CompanyX" />
    ....
    <Click Handler="CompanyX.SetTimeStamp();" />

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. UserControl Direct Method is not Firing...
    By nagesh in forum 2.x Help
    Replies: 3
    Last Post: Nov 29, 2012, 1:06 PM
  3. Desktop Window gridpanel direct event not firing
    By Karun Javvadi in forum 2.x Help
    Replies: 0
    Last Post: Jul 31, 2012, 12:16 PM
  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. Ajax method firing twice from listener?
    By Tbaseflug in forum 1.x Help
    Replies: 1
    Last Post: Nov 18, 2009, 4:28 PM

Tags for this Thread

Posting Permissions