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

RadGrid BiffExporting Ajax problem

2 Answers 121 Views
Grid
This is a migrated thread and some comments may be shown as answers.
MathieuB
Top achievements
Rank 1
MathieuB asked on 20 Jun 2014, 02:45 PM
Hi,
    First i'm sorry for my bad english, I'm not really good. But I will try to explain my problem for you can understand.

I want export my RadGrid in a Excel file (Biff). In my RadGrid I don't use the orignal CommandItem, I have add a personnal RadToolBar where I have add my Export button. When I click of my Button, I call a JS method (onPanelBarItemClicked) who calls the Click Event of my btnExport (this button isn't visible)

function onPanelBarItemClicked(sender, args) {
    if (args.get_item().get_commandName() == "ExportToExcel") {
        if (!alertDirtyNavigation()) {
            return false;
            }
         $find("<%=btnExport.ClientID%>").click();
        }
    }
 
{...}
<div style="display: none">
    <telerik:RadButton ID="btnExport" runat="server" AutoPostBack="true" CausesValidation="false" ButtonType="StandardButton" Target="_self"></telerik:RadButton>
</div>
 
{...}
<CommandItemTemplate>
            <div>
                <telerik:RadToolBar ID="RadToolBarGridEdit" runat="server" Width="100%" Height="25px" OnClientButtonClicked="onPanelBarItemClicked">
                    <Items>
 <telerik:RadToolBarButton Text="<% $Resources:General, ExportButtonText %>" Value="ExportButton" CommandName="ExportToExcel" AccessKey="E" ImageUrl="~/Images/16X16/export.png" ImagePosition="Right" PostBack="false"></telerik:RadToolBarButton>
                    </Items>
                </telerik:RadToolBar>
            </div>
        </CommandItemTemplate>

The code of btnExport.Click.

Private Sub btnExport_Click(sender As Object, e As EventArgs) Handles btnExport.Click
        GridFunction.ExportGridToExcel(Me.RadGridDepartement)
End Sub

With this method, the XLS file is generated and i can download the file. But, I don't have LoadingPanel for show that application working.



If in my JS method I add the method for show the LoadingPanel. The loadingPanel appears and I can donwload my file. But my problem is that the loadingPanel never disappears. (LoadingPanelNeverDisappears.png)
function onPanelBarItemClicked(sender, args) {
    if (args.get_item().get_commandName() == "ExportToExcel") {
        if (!alertDirtyNavigation()) {
            return false;
            }
         showMainLoadingPanel("<%=RadGridDepartement.ClientID%>"); 
         $find("<%=btnExport.ClientID%>").click();
        }
    }

For can resolve this problem. I have added AjaxSettings in the RadAjaxManagerProxy. But i have a new  and big problem. After the XLS generation, I can't download my file. And in my RadGrid, my action column has disappeared, the width of my Data Column are too large and the PagerStyle has disappeared. (GridBug.png)
<telerik:AjaxSetting AjaxControlID="btnExport">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="btnExport" />  
                <telerik:AjaxUpdatedControl ControlID="RadGridDepartement" />
            </UpdatedControls>
        </telerik:AjaxSetting>

Do you have a solution ? I have search in forum and with google. But the solution isn't really relevant in my situation. 

We have : 
 - MasterPage 
 - BaseUserControl (all page Inherits) 
 - Page.


Thank you so much.
Mathieu B.

2 Answers, 1 is accepted

Sort by
0
Accepted
Kostadin
Telerik team
answered on 25 Jun 2014, 10:35 AM
Hi Mathieu,

Thank you for contacting us.

Note that the exporting feature works only with regular postbacks. This means, that the asynchronous postback should be canceled when performing an export. If you need to display a loading panel you could try the approach from the following code library.

I hope this information helps.

Regards,
Kostadin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
MathieuB
Top achievements
Rank 1
answered on 25 Jun 2014, 12:47 PM
HI Kostadin,
                    thank you very much, this solution seems to work perfectly. I now looked for generalized in all my pages because at the moment I've only used in a test page. 

Again thank you and good day to you.
Mathieu B
Tags
Grid
Asked by
MathieuB
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
MathieuB
Top achievements
Rank 1
Share this question
or