Update handler for button

  1. #1

    Update handler for button

    Hello. I have the following markup:
    ...
    <ext:Button ID="RefreshDoc" runat="server" Icon="Reload" >
       <DirectEvents>
          <Click OnEvent="RefreshDocument" Type="Load" Method="POST" Success="doStuffAfterSuccess();">
             <ExtraParams>
    	    <ext:Parameter Name="Id" Value="#{Id}.getValue()" Mode="Raw" />
             </ExtraParams>  
             <EventMask ShowMask="true" MinDelay="500" />
          </Click>
       </DirectEvents>
    </ext:Button>
    
     <ext:Button ID="ShowChildButton" runat="server" Icon="ClockGo" Text="Show Child" >
     </ext:Button>
    This is the RefreshDocument method:
    public void RefreshDocument(object sender, DirectEventArgs e)
    {
       var id = e.ExtraParams.ToDictionary(o => o.Name, v => v.Value).ToGuidId();
       if (id == Guid.Empty)
       {
          this.ShowChildButton.Disabled = true;
          return;
       }
      
       // skip url building for brevity
       this.ShowChildButton.Disabled = false;
       this.ShowChildButton.Listeners.Click.Handler ="console.log(1);"
               
    }
    As you can see, I send Id, sometimes it can be empty. And when it's empty then button is disabled. After some other actions Id can be filled and when I click `RefreshDoc` button then `ShowChildButton` shows and clickable, but the handler doesn't call.
    Where is a problem?

    PS. It looks like handler doesn't exist in the response, only disabled/enabled properties (I skipped some strings for brevity):
    {script:"Ext.net.ResourceMgr.registerIcon([\"FolderPicture\"]);ShowChildButton.setDisabled(false); ... }
    Last edited by sharok; Aug 25, 2015 at 10:31 AM.
  2. #2
    Hi @sharok,

    Welcome to the Ext.NET forums!

    Yes, a Button's Listeners is only taken into account before rendering. If a Button is rendered, it doesn't produce any effect.

    Please have a look at this post. There is a few suggestions how to attach listeners on the fly.
    http://forums.ext.net/showthread.php...l=1#post121911

Similar Threads

  1. Replies: 3
    Last Post: Apr 27, 2015, 8:43 PM
  2. [CLOSED] Problem With TaskManager's Update.Handler and Image
    By matrixwebtech in forum 2.x Legacy Premium Help
    Replies: 14
    Last Post: Dec 03, 2014, 3:13 PM
  3. Replies: 4
    Last Post: Jun 11, 2013, 6:02 AM
  4. The handler of OK button in Msg.Show(...)
    By AlexMaslakov in forum 1.x Help
    Replies: 0
    Last Post: Nov 02, 2011, 11:07 AM
  5. Replies: 2
    Last Post: Jul 15, 2010, 8:36 PM

Tags for this Thread

Posting Permissions