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

Export to Excel blocking Window opening

3 Answers 95 Views
Window
This is a migrated thread and some comments may be shown as answers.
Archana
Top achievements
Rank 1
Archana asked on 23 Apr 2013, 10:53 PM
Hi,

I have my code shown like below:



<

 

 

telerik:RadScriptManager ID="RadScriptManager" runat="server">

 

</telerik:RadScriptManager>

 

<radW:RadWindowManager ID="RadWindowManagerDefineView" runat="server" RadControlsDir="~/Includes/RadControls"

 

Skin="Office2007" ClientCallBackFunction="CallBackFunction">

 

<Windows>

 

<radW:RadWindow ID="RadWindowDefineView" ReloadOnShow="true" Top="5px" Modal="true"

 

Behavior="Close" runat="server" NavigateUrl="ModifyFilters.aspx"

 

RadControlsDir="~/Includes/RadControls" Width="560px" Height="582px"></radW:RadWindow>

 

</Windows>

 

</radW:RadWindowManager>

<
asp:UpdatePanel ID="testPanel" runat="server">
<ContentTemplate>
<div id="divHeader">
    <center>
        <table style="width: 95%">
            <tr>
                <td>
                    Age:
                </td>
                <td>
                    <cc2:Filter ID="msAccountWasAge" runat="server" ListSize="8" PromptClass="FilterLabel"
                        ImageClass="MSDDImg" ImagePath="../../Images/pullDown.JPG" ListBoxClass="MSDDListBox"
                        TextBoxClass="MSDDTextBox" ZIndex="300" />
                </td>
                <td>
                    Country:
                </td>
                <td>
                    <cc2:Filter ID="msCountry" runat="server" ListSize="9" PromptClass="FilterLabel"
                        ImageClass="MSDDImg" ImagePath="../../Images/pullDown.JPG" ListBoxClass="MSDDListBoxCompare"
                        TextBoxClass="MSDDTextBoxCompare" ZIndex="300" />
                </td>
                <td>
                    <asp:ImageButton ID="ImageButtonRefresh" Height="25px" Style="float: left" OnClientClick="displayWaitAndSetPanel();"
                        Width="25px" runat="server" ImageUrl="../../Images/Refresh.png" />
                    <asp:ImageButton ID="ImageButtonExportExcel" runat="server" Height="25px" Width="25px"
                        ImageAlign="Left" ImageUrl="../../Images/excel.jpg" Style="float: left" AlternateText="Export to Excel">
                    </asp:ImageButton>
            </td>
            </tr>
            <tr>
                <td colspan="6">
                </td>
            </tr>
        </table>
    </center>
</div></ContentTemplate>
</asp:UpdatePanel>
<asp:Button ID="btnAddPanel" runat="server" CssClass="btnSmall" Text="Add Panel" />
<asp:Label ID="lblShowWarning" runat="server" Visible="false" ForeColor="Red"></asp:Label>
<asp:Panel ID="pnlLayout" runat="server" Width="100%" Height="400px">
    <telerik:RadDockLayout ID="RadDockLayout" runat="server" Skin="Office2007" StoreLayoutInViewState="true">
        <telerik:RadDockZone ID="RadDockZone" Width="400px" Height="200px" MinWidth="800px"
            runat="server" Orientation="Horizontal">
        </telerik:RadDockZone>
    </telerik:RadDockLayout>
</asp:Panel>

Where filter is a custom multiselect dropdown control.
When a user clicks on refresh button a custom panel with a grid/RadDock is added to the RadDockZone, this grid has a button which opens a popup using javascript given below:

function ShowModifyFilters(ID) {
            var oManager = GetRadWindowManager();
            var oWnd = oManager.GetWindowByName("RadWindowDefineView");
            oWnd.argument = ID;
 
            if (WindowUrl == null)
                WindowUrl = oWnd.GetUrl();
 
            oWnd.SetUrl(WindowUrl + "?SavedPanelID=" + ID);
            oWnd.Show();
            alert(WindowUrl + "?SavedPanelID=" + ID);
        }

Everything works fine until Export to Excel is clicked. Once its clicked the popup is not shown I can see only alert displaying the url. But I'm able to click on refresh button and Add Panel button which opens same popup fine from server-side. I tried adding PorstBackTrigger to UpdatePanel but it didnt work. Can you please help me find whats wrong with the code?

3 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 24 Apr 2013, 01:58 PM
Hi Archana,

If I understand you correctly you call this function from the server code. Exporting requires a full postback and changes the response (including the HTTP headers) so that the file is sent to the browser. This means that scripts cannot be called from the server when exports are made or files are sent.

If possible, you can move the logic that calls this method to the client so that the user initiates it with a client-side click on a button/link/etc. instead of having to go through the server.


Kind regards,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Archana
Top achievements
Rank 1
answered on 24 Apr 2013, 05:07 PM

I'm creating a RadDock and adding folloiwng class to to its command.

public class DockDefineViewCommand : DockCommand
    {
        public DockDefineViewCommand()
        {
            this.AutoPostBack = false;
            this.CssClass = "CustomCommandStyle";
            this.Text = "Define View";
            this.Name = "DefineView";
            this.OnClientCommand = "ShowFilters";
        }
 
    }

where ShowFilters calls ShowModifyFilters function

function ShowFilters(PanelID) {
 
     ShowModifyFilters(PanelID.get_uniqueName());  
}


What changes should I do to this one?

0
Marin Bratanov
Telerik team
answered on 26 Apr 2013, 01:27 PM
Hi Archana,

I do not see how this is related to the RadWindow and this information is not sufficient to determine what is the problem. Generally, downloading a file means that you need a full postback and that you cannot execute scripts after that. If clicking this button results in a JavaScript error it is possible that this blocks the opening of the popup. You should also make sure that you recreate the command that calls the function that opens the popup.

I advise that you post code that can be run in order for us to see the problem, debug it and help.


Greetings,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Window
Asked by
Archana
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Archana
Top achievements
Rank 1
Share this question
or