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

Radgrid export and ajaxloadingpanel

1 Answer 134 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gallaz Philippe
Top achievements
Rank 1
Gallaz Philippe asked on 19 Oct 2010, 10:49 AM
Hello,

I have an issue using the RadGrid export functions. The RadGrid is placed on a RadAjaxPanel combined with a RadAjaxLoadingPanel. The RadAjaxLoadingPanel is displayed when clicking on the integrated grid export button but it remains open after the file has been downloaded. I would like to not display the RadAjaxLoadingPanel when clicking on export or hide it after download. I tried to hide the RadAjaxLoadingPanel in the onRequestStart method with following code without success:

function onRequestStart(sender, args)
            {
                if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0 ||
                                                args.get_eventTarget().indexOf("ExportToWordButton") >= 0 ||
                                                args.get_eventTarget().indexOf("ExportToCsvButton") >= 0) {
                    alert("no ajax");
                    args.set_enableAjax(false);
                    currentLoadingPanel = $find("<%= rAJLoadingPanel.ClientID %>");
                    currentLoadingPanel.hide(currentLoadingPanel);
                    currentLoadingPanel.style.visibility = 'hidden';
            }




Please try the code attached taken from Telerik RadGrid Export samples to reproduce the problem

<%@ Page Language="c#" Inherits="Telerik.GridExamplesCSharp.GeneralFeatures.Exporting.DefaultCS"
    CodeFile="DefaultCS.aspx.cs" %>
 
<%@ Register TagPrefix="telerik" Namespace="Telerik.QuickStart" %>
<%@ Register TagPrefix="telerik" TagName="Header" Src="~/Common/Header.ascx" %>
<%@ Register TagPrefix="telerik" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %>
<%@ Register TagPrefix="telerik" TagName="Footer" Src="~/Common/Footer.ascx" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<head runat="server">
    <telerik:HeadTag runat="server" ID="Headtag2"></telerik:HeadTag>
</head>
<body class="BODY">
    <form runat="server" id="mainForm" method="post">
    <telerik:Header runat="server" ID="Header1" NavigationLanguage="CS"></telerik:Header>
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
    <!-- content start -->
    <div class="module" style="height: 110px; width: 92%">
        <asp:CheckBox ID="CheckBox1" Text="Export only data" runat="server"></asp:CheckBox>
        <br />
        <asp:CheckBox ID="CheckBox2" Text="Ignore paging (exports all pages)" runat="server">
        </asp:CheckBox>
        <br />
        <asp:CheckBox ID="CheckBox3" Text="Open exported data in new browser window" runat="server">
        </asp:CheckBox>
        <br />
        <br />
        <asp:Button ID="Button1" CssClass="button" Width="150px" Text="Export to Excel" OnClick="Button1_Click"
            runat="server"></asp:Button>
        <asp:Button ID="Button2" CssClass="button" Width="150px" Text="Export to Word" OnClick="Button2_Click"
            runat="server"></asp:Button>
        <asp:Button ID="Button3" CssClass="button" Width="150px" Text="Export to CSV" OnClick="Button3_Click"
            runat="server"></asp:Button>
    </div>
    <br />
 
    <script type="text/javascript">
        function onRequestStart(sender, args)
        {
            if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToWordButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToCsvButton") >= 0) {               
                args.set_enableAjax(false);
            }
        }
    </script>
    <telerik:RadAjaxLoadingPanel ID="rAJLoadingPanel" runat="server" Skin="Default" />
    <telerik:RadAjaxPanel ID="radPanel" runat="server" LoadingPanelID="rAJLoadingPanel">
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <ClientEvents OnRequestStart="onRequestStart" />
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="radPanel" LoadingPanelID="rAJLoadingPanel" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" AllowSorting="True"
        AllowPaging="True" PageSize="10" runat="server" GridLines="None" Width="95%"
        OnItemCommand="RadGrid1_ItemCommand">
        <ExportSettings HideStructureColumns="true" />
        <MasterTableView Width="100%" CommandItemDisplay="Top">
            <PagerStyle Mode="NextPrevNumericAndAdvanced" />
            <CommandItemSettings ShowExportToWordButton="true" ShowExportToExcelButton="true"
                ShowExportToCsvButton="true" />
        </MasterTableView>
    </telerik:RadGrid>
    </telerik:RadAjaxPanel>
    <br />
    <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
        ProviderName="System.Data.SqlClient" SelectCommand="SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, PostalCode FROM Customers"
        runat="server"></asp:SqlDataSource>
    <!-- content end -->
    <telerik:Footer runat="server" ID="Footer1"></telerik:Footer>
    </form>
</body>
</html>


I

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 22 Oct 2010, 10:36 PM
Hello Gallaz,

The problem is that you ajaxify RadGrid with RadAjaxManager and RadAjaxPanel at the same time. Please choose which of these controls to use and then remove the other one.

Best regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Gallaz Philippe
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or