This is a migrated thread and some comments may be shown as answers.

How can find the button clicked onAjaxRequestStart?

3 Answers 54 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Allin
Top achievements
Rank 1
Allin asked on 11 Feb 2014, 02:11 PM
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

3 Answers, 1 is accepted

Sort by
0
Kate
Telerik team
answered on 14 Feb 2014, 09:49 AM
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.
0
Allin
Top achievements
Rank 1
answered on 14 Feb 2014, 01:02 PM
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.
0
Kate
Telerik team
answered on 19 Feb 2014, 11:34 AM
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.
Tags
ToolBar
Asked by
Allin
Top achievements
Rank 1
Answers by
Kate
Telerik team
Allin
Top achievements
Rank 1
Share this question
or