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

Ajax asynchronous

1 Answer 125 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
brad asked on 18 Sep 2008, 12:35 AM

I have a content page, with a radtoolbar and a radgrid. were using the radajaxmanger as well. on the radtoolbar is a button then when pressed use's ajax and javascript to load the page in the form of a model pop up view. on the toolbar as well, is an edit button, then when a record on the grid is selected and the edit button is clicked, uses ajax and javascript to load another page in modal pop up view.

the next 2 buttons, enable or disable records on the grid when a row on the grid is selected and 1 of the buttons is clicked.

then we have a button with export to excel.

heres the problem. export to excel and the enable and disable buttons will not fire with the ajax on the page. without the ajax, the modal pop up view pages will not fire, but the export to excel and disable/enable buttons will.

i used the RadAjaxManager.GetCurrent(this.Page).AjaxSettings.Clear(); line of code to clear the ajax then try to fire the export toexcel, however the button needs to be double clicked because the ajax isn't actually cleared until the postback occurs.

so you click the button once, it clears the ajax, you ahve to click the same button again for the export to excel to actually fire since the ajax cleared after the postback from the previous click.

same happens vice versa when trying to activate the ajax back in so the modal pop up views will work, the button has to be clicked twice because the ajax won't activate till after the postback.

im looking for suggestions to make the button 1 click to clear the ajax, do the postback, then run the export to excel for the grid data.

here is current coding.


            GridView1.ExportSettings.ExportOnlyData = true;
            GridView1.ExportSettings.OpenInNewWindow = true;
            GridView1.ExportSettings.FileName = "RulesExport";

when re-enabling the ajax.....

RadAjaxManager1 = (RadAjaxManager)Master.FindControl("RadAjaxManager1");
            RadAjaxLoadingPanel1 = (RadAjaxLoadingPanel)Master.FindControl("RadAjaxLoadingPanel1");
            RadAjaxManager.GetCurrent(this.Page).AjaxSettings.AddAjaxSetting(RadAjaxManager1, this.GridView1, RadAjaxLoadingPanel1);
            RadAjaxManager.GetCurrent(this.Page).AjaxSettings.AddAjaxSetting(this.gridPane, this.GridView1, RadAjaxLoadingPanel1);

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 22 Sep 2008, 10:27 AM
Hello brad,

You should disable ajax client-side just before posting the form to export to Excel. Changing content types (like the grid Excel export) are not possible with XmlHttpRequest object. You can check this example for more info how to disable ajax conditionally:

Best wishes,
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question