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

Re enable Ajax after disabling it on client side

2 Answers 106 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Alexandre BARBIER
Top achievements
Rank 1
Alexandre BARBIER asked on 31 Jan 2011, 02:08 PM
I'm using a RadGrid within a RajAjaxManager.
On a specific LinkButton, I need to export the content of the grid to CSV.
So I need to disable Ajax to allow export works. I'm doing this :

<

 

script type="text/javascript">

 

 

function mngRequestStartedEAE(ajaxManager, eventArgs) {

 

 

if (eventArgs.EventTarget.indexOf("exportCsv") != -1) {

 

eventArgs.EnableAjax =

false;

 

}

 

}

 

</

 

script>
<

telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" ClientEvents-OnRequestStart="mngRequestStartedEAE" >

    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="content">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="content" LoadingPanelID="RadAjaxLoadingPanel1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Transparency="10"
    BackColor="#ffffff" CssClass="ajax_loader">
</telerik:RadAjaxLoadingPanel>
<asp:Panel ID="content" runat="server" CssClass="MaxW">
<!-- some other controls -->
<asp:LinkButton ID="exportCsv" runat="server" OnClick="exportCsv_Click" Text="Exporter"></asp:LinkButton>
<!-- grid declaration ... -->
</asp:Panel>

All of this works fine ! BUT :
All other next requests doesn't works, because no more ajax is running :( So all actions like autopostback on controls within content panel are not invoked...

What am I doing wrong ?

Thanks for help !

2 Answers, 1 is accepted

Sort by
0
Accepted
Vasil
Telerik team
answered on 03 Feb 2011, 02:54 PM
Hi Alexandre,

When the Ajax is enabled on the server it should be enabled by default after every postback even if you disable it on the client. This happens because the enabled setting is not persisted when changed client side and the next time the page loads it will be enabled again. It can see in this online demo that ajax requests are working after exporting the grid.

Additionally you can try to place the LinkButton outside the 'content'  Panel which is ajaxified. This way the button will make regular postback, and you will not have to disable the ajax.
You can also check this help articles:
http://www.telerik.com/help/aspnet-ajax/grdexportwithajax.html
http://www.telerik.com/help/aspnet-ajax/ajxexclude.html

If you are still having such problem please share with us the whole aspx page that you use and its code behind.

All the best,
Vasil
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Alexandre BARBIER
Top achievements
Rank 1
answered on 07 Feb 2011, 11:21 AM
Hi

I've finally found the issue, and you're right it is not a Grid export issue with ajax.
It's just I used it into a control hosted into a SharePoint 2007 webpart page, and I've forgot the put the special trick that enabled ajax at every request. This trick modify the submit  JS function (from sharepoint) at page init event ...

SO It's working fine....

Thanks for reply

Regards.
Tags
Ajax
Asked by
Alexandre BARBIER
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Alexandre BARBIER
Top achievements
Rank 1
Share this question
or