How can find the button clicked onAjaxRequestStart?

4 posts, 0 answers
  1. Allin
    Allin avatar
    33 posts
    Member since:
    Jun 2012

    Posted 11 Feb 2014 Link to this post

    Hi,

    I want to disabled ajax only for one button into my toolbar because i need to download a file and i have some problems with if the ajax is enabled.

    function onAjaxRequestStartHandler(sender, args) {
          if (args.get_eventTarget().indexOf("RadToolBarReport") >= 0)
              if (myButtonExport is clicked) {
                  args.set_enableAjax(false);
                  }
           }

    I look to replace IF (myButtonExport is clicked) by a javascript code to know what is the button clicked...

    Someone can help me ?

    ty
  2. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 14 Feb 2014 Link to this post

    Hello Allin,

    Please refer to the following forum post where you can find more detailed explanation how to disable ajax request for single controls - Exclude Controls from Ajaxifying.

    Regards,
    Kate
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Allin
    Allin avatar
    33 posts
    Member since:
    Jun 2012

    Posted 14 Feb 2014 in reply to Kate Link to this post

    Hi,

    My issue is i can't find what button into my RadToolBar is clicked in ajaxRequestStart i want to disable ajax only 1 of the 4 buttons in this toolbar. The target only show the radtoolbar.
  5. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 19 Feb 2014 Link to this post

    Hello Allin,

    Try using the following code to find the toolbar and the button that is clicked in order to cancel the ajax request whenever a button with text value "ExportGrid" (as in this particular example) is being clicked:
    function onRequestStart(sender, args) {
              if (args.get_eventTarget() == "RadToolBar1") {
            var toolBar = $find(args.get_eventTargetElement().id);
            var index = parseInt(args.get_eventArgument());
          var buttonText = toolBar.get_items().getItem(index).get_text();
     
                           if (buttonText == "ExportGrid") {
                               args.set_enableAjax(false);
                           }
                       }
                   }

    Regards,
    Kate
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top