Ajax Methods do not run for Button Handler if Button ID is set

  1. #1

    Ajax Methods do not run for Button Handler if Button ID is set

    See the code below. If you comment out the ID, the AjaxMethod is called. If you do not comment out the ID, the AjaxMethod is never called.

    Thank!

    This is the code that creates the button. Notice that if ID is commented out, AjaxMethod will be called. If i leave the ID in, the AjaxMethod is never called.

    Coolite.Ext.Web.Button btnAddScript = new Coolite.Ext.Web.Button();
    btnAddScript.Text = "Assign Script";
    // btnAddScript.ID = "addScript";
    btnAddScript.Icon = Icon.ScriptAdd;
    ToolTip tip3 = newToolTip();
    tip3.Html = "Click to assign a script to a specific order";
    btnAddScript.Listeners.Click.Handler = "Coolite.AjaxMethods.showAddScriptWindow(" + companyId + ", { success: function(response, opts) { Ext.Msg.alert('response', response); }, failure: function(response, opts) { Ext.Msg.alert('response', response); } });";
    btnAddScript.ToolTips.Add(tip3);
     
     
     
    [AjaxMethod]
    publicvoid showAddScriptWindow(object sender, AjaxEventArgs e)
    {
    string clientId = sender.ToString();
    this.AssignScript.Show(Convert.ToInt32(clientId), this.TreePanel1);
    }
  2. #2
    I have not actually tried to reproduce this, but this might relate to the button's id itself ("addScript"). Can you try changing the id to something else (let's say, btn1) and then the code again.
  3. #3
    Hi,

    The problem is related with signature of your ajax method. Please change it like
    public void showAddScriptWindow(int companyId)

Similar Threads

  1. 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
  2. Radio button Handler
    By vs.mukesh in forum 1.x Help
    Replies: 0
    Last Post: Jul 01, 2010, 9:55 AM
  3. Button and server side event handler
    By dan182 in forum 1.x Help
    Replies: 3
    Last Post: Jun 23, 2010, 1:06 PM
  4. Replies: 3
    Last Post: Feb 02, 2010, 6:32 PM
  5. [CLOSED] Button AJAX Event and Handler Parameters
    By amitpareek in forum 1.x Help
    Replies: 3
    Last Post: Sep 17, 2008, 6:48 PM

Posting Permissions