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

[Solved] RadAjaxPanel, RadWindow and RadGrid ExportToExcel

3 Answers 125 Views
Window
This is a migrated thread and some comments may be shown as answers.
Anthony
Top achievements
Rank 1
Anthony asked on 13 Jun 2008, 07:31 PM
Hello,

I had aspx code that is structure like below

ASPX:
<Form>
    <RadAjaxPanel ClientEvents-OnRequestStart="PanelRequestStarted"...>
        <asp:Table ...>
            <asp:TableRow ...>
                <asp:TableCell>
                    <asp:ImageButton ID="ImageButtonExport" OnClick="ImageButtonExport_Click" ... />
                <asp:TableCell>
                <asp:TableCell>
                    <asp:Button ID="ButtonCallDialog" ... />
                <asp:TableCell>
            </asp:TableRow>
        </asp:Table>
    <asp:Panel ...>
        <RadGrid ID='RadGridExport' ... >
        </RadGrid>
    </asp:Panel>
    </RadAjaxPanel>
    <RadWindowManager...>
        <windows>
            <RadWindow ID="RadWindowDialog" ...>
            </RadWindow>
        </windows>
    </RadWindowManager>
    <AjaxLoadingPanel ...>
        ...
    </AjaxLoadingPanel>
    <Script>
        function ShowDialog()
        {
            var radWindow = window.radopen(null, "RadWindowDialog");
            radWindow.SetUrl(radWindow.GetUrl());
        }

        function PanelRequestStarted(ajaxPanel, eventArgs)
        {
            if (eventArgs.EventTarget = 'ImageButtonExport')
                eventArgs.EnableAjax=false;
        }
    </Script>
</Form>

C#:
private void Page_Load(object sender, EventArgs e)
{
    ButtonCallDialog.Attributes.Add("OnClick", "ShowDialog();return false;");
}

protected void ImageButtonExport_Click(object sender, ImageClickEventArgs e)
{
    RadGridExport.ExportSettings.OpenInNewWindow = true;
    RadGridExport.MasterTableView.ExportToExcel();
}

I click ImageButtonExport first and the it asked whether I want to open or save, I choose to open (it need to get open out side browser not in side browser).
The problem happen after it open up excel spreadsheet I went back to the page and click on ButtonCallDialog  I had to click twice. The first click gave me an error "'null' is null or not an object" second click succefully display RadWindow.

What do I need to do to get ButtonCallDialog work on the first click?

Thanks.

3 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 17 Jun 2008, 05:22 AM
Hello Anthony,

I am not quite sure what exactly causes the described error - it seems that you are trying to obtain a reference to an object which is still not created.

In order to be able to help I need to examine and debug your project. Would you please open a new support ticket and send me a fully runnable (including a DB if needed) reproduction project? Once I receive it I will do my best to help.

Sincerely yours,
Svetlina
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Anthony
Top achievements
Rank 1
answered on 18 Jun 2008, 09:38 PM
Svetlina,

I have tried to duplicate this problem with small application and the same structure but I can't duplicate it, then I started to look at RadWindowClient.js.

It look like to me after opening up excel document, document.readyState is still in "interactive" state instead of "complete" state. This is where I got lost, is there a way to set RadWindow that document.readyState to its orignal state (which is "complete") after opening up excel document?

Thanks.
0
Svetlina Anati
Telerik team
answered on 23 Jun 2008, 12:40 PM
Hello Anthony,

As far as I understand from your post, you are using RadControls for ASP.NET and not RadControls for ASP.NET AJAX.

I prepared a sample test project but I was unable to reproduce the problem - please examine the attached demo. A similar problem was reported once before and we researched it but unfortunately we were not able to find a workaround.

What we can suggest is to upgrade to RadWindow for ASP.NET AJAX - this should fix the problem. Furthermore, there is a compatibility layer between RadWindow for ASP.NET and RadWindow for ASP.NET AJAX - this means that you will have to make only slight modifications to your code and most of the client methods will work despite they are written in the RadWindow for ASP.NET naming convention.


All the best,
Svetlina
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Window
Asked by
Anthony
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Anthony
Top achievements
Rank 1
Share this question
or