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

[Solved] Firefox's download dialog doesn't show up

13 Answers 240 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Goran
Top achievements
Rank 1
Goran asked on 19 Feb 2013, 08:44 AM
Hi,

I have 2 web applications. First one is our company project where we use Telerik's grid. I'm trying to export grid to MS Excel file by clicking grid's context menu option using the following code:

this.Grid.ExportSettings.ExportOnlyData = true;
this.Grid.ExportSettings.OpenInNewWindow = true;
this.Grid.MasterTableView.ExportToExcel();

But, Firefox's download dialog doesn't show up.

The second application is simpler test application where Telerik's grid is used as well. When I click grid's context menu option download dialog shows up.

It's obvious it's up to something in the code in first more complex application, but I can't find what for now. I'm just wondering if there's any setting I forgot to set up...

I appreciate any help.

Goran

13 Answers, 1 is accepted

Sort by
0
Goran
Top achievements
Rank 1
answered on 20 Feb 2013, 11:23 AM
Or is there any case in which showing Firefox's download dialog during exporting grid to Excel file could be prevented?
0
Goran
Top achievements
Rank 1
answered on 21 Feb 2013, 12:17 PM
I know the question is a bit "undefined", but I'm just trying to find something that could point me to right direction.

Could someone help with this, please?
0
Radoslav
Telerik team
answered on 22 Feb 2013, 11:08 AM
Hi Goran,

Could you please verify that you do not have an ajax request when trying to export the RadGrid?  If you ajaxify the RadGrid you need to disable the ajax and perform full post back when exporting the data , like is shown on the following online example:
http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/exporting/defaultcs.aspx

Looking forward for your reply.

Regards,
Radoslav
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
Goran
Top achievements
Rank 1
answered on 25 Feb 2013, 09:11 AM
Hi Radoslav,

We use Telerik's grid version: 2011.3.1115.0 in VS2008 (.NET 3.5), which doesn't have built-in export buttons. We have grid's context menu where one of options is "Export to Excel". Could you suggest me, please, how can we make it work?

Goran
0
Radoslav
Telerik team
answered on 28 Feb 2013, 09:21 AM
Hi Goran,

Based on the provided information it is hard to say what is causing the described issue on your end. Could you please post your aspx page markup code with the related code behind file? Thus we will be able to gather more details about your scenario and provide you with more to-the-point answer.

At a meantime if you use RadAjaxManager or RadAjaxPanel somewhere on your page could you please try disabling them by setting EnableAJAX property to “false” and let me know if the issue still persists.

Regards,
Radoslav
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
Goran
Top achievements
Rank 1
answered on 04 Mar 2013, 06:56 AM
I've set EnableAJAX property on every particular place to "false", but it's still not working.

We actually have master page (complex system where main master page inherits from 2 base master pages). Here's the basic structure of our code:

MASTER: BasePage.Master -> WindowPage.master -> ViewFormPage.master

MAIN CONTENT: ContentViewForm.aspx (ID="ViewFormPlaceHolder"), ContentViewForm.aspx.cs:

public partial class ContentViewForm : ViewFormBaseDocument
{
}
 
public abstract class ViewFormBaseDocument : ViewFormPageWrapper
{
    private GridFrameControl CreateGridFrameControl(GridFrame gridFrame)
    {
        var gridFrameControl = LoadControl("Controls/GridFrameControl.ascx") as GridFrameControl;
    }
}
 
public partial class GridFrameControl : ActionFrameControl, IProfileSetting
{

Here's the markup code of content page without setting EnableAjax to "false":

<%@ Page Title="" Language="C#" MasterPageFile="~/ViewFormPage.master" AutoEventWireup="true"
    CodeBehind="ContentViewForm.aspx.cs" Inherits="Parus.WebClient.ContentViewForm" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="ViewFormContent" ContentPlaceHolderID="ViewFormPlaceHolder" runat="server">
    <telerik:RadAjaxManager ID="AjaxManager" runat="server" DefaultLoadingPanelID="AjaxLoadingPanel" />
    <telerik:RadAjaxLoadingPanel ID="AjaxLoadingPanel" runat="server" />
    <telerik:RadSplitter ID="viewSplitter" runat="server">
        <telerik:RadPane ID="catalogsPane" runat="server">
            <telerik:RadAjaxPanel ID="treeUpdatePanel" runat="server">
                <div id="catalogs">
                    <telerik:RadTabStrip ID="tabStripCatalogs" runat="server" MultiPageID="multiPageCatalogs" />
                    <telerik:RadMultiPage ID="multiPageCatalogs" runat="server" />
                </div>
            </telerik:RadAjaxPanel>
        </telerik:RadPane>
        <telerik:RadSplitBar ID="catalogsSplitBar" runat="server" />
        <telerik:RadPane ID="gridsPane" runat="Server" />
    </telerik:RadSplitter>
</asp:Content>

The code behind of content page is class:

public partial class ContentViewForm : ViewFormBaseDocument
{

And the code behind of ViewFormBaseDocument class where we dynamically load our user control where Telerik grid is actually is placed looks as following:

private GridFrameControl CreateGridFrameControl(GridFrame gridFrame)
{
    var gridFrameControl = LoadControl("Controls/GridFrameControl.ascx") as GridFrameControl;

The GridFrameControl user control markup looks as following:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="GridFrameControl.ascx.cs"
    Inherits="Parus.WebClient.Controls.GridFrameControl" %>
<%@ Register Assembly="Parus.Controls" Namespace="Parus.Controls" TagPrefix="parus" %>
<asp:Panel ID="ContentPanel" runat="server">
    <asp:UpdatePanel ID="PostbackPanel" runat="server">
        <ContentTemplate>
            <div id="actionsMenuDiv">
                <parus:Menu ID="actionsMenu" runat="server" />
            </div>
            <parus:GridContextMenu runat="server" ID="contextMenu"/>
            <parus:ServerRequest runat="server" ID="ServerRequest" />
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Panel>

And some part of it's code behind that could be important:

protected override void OnInit(EventArgs e)
{
    base.OnInit(e);
 
    this.Grid = CreateGrid();
 
    if (!this.Frame.FrameData.ManualDataSource)
    {
        this.DataSource = CreateDataSource(this.Frame);
        this.DataSource.OnGetFilterExpression += this.GetFilterExpression;
        this.DataSource.OnGetSortExpression += this.GetSortExpression;
        this.Grid.DataSourceID = this.DataSource.ID;
        this.ContentPanel.Controls.Add(this.DataSource);
    }
 
    this.InitGridControl();
 
    this.PostbackPanel.ContentTemplateContainer.Controls.Add(this.Grid);
 
    ContentPanel.Width = Unit.Percentage(100);
    ContentPanel.Height = Unit.Percentage(100);
 
    PostbackPanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
 
    actionsMenu.Width = Unit.Percentage(100);
    actionsMenu.EnableShadows = true;
    actionsMenu.EnableRoundedCorners = false;
    actionsMenu.Style.Value = "z-index: 3000;";
    actionsMenu.CollapseAnimation.Type = AnimationType.InOutExpo;
    actionsMenu.ExpandAnimation.Type = AnimationType.InOutExpo;
    actionsMenu.CollapseAnimation.Duration = 100;
    actionsMenu.ExpandAnimation.Duration = 100;
    actionsMenu.EnableAjaxSkinRendering = true;
    actionsMenu.EnableEmbeddedSkins = true;
    actionsMenu.EnableViewState = false;
    actionsMenu.LinkedControlClientId = ServerRequest.ClientID;
    actionsMenu.OnClientItemClicked = "GridToolbar_ActionsHandler";
    CreateMenuItems(actionsMenu.Items, this.Frame.ViewFrameData.ActionItems);
 
    Frame.GetFieldValue += GetFieldValue;
    Frame.GetServerConditionValues += GetServerConditionValues;
 
    ServerRequest.RequestContext = this.Grid.ClientID;
    ServerRequest.RequestMode = RequestMode.Postback;
    ServerRequest.OnClientResponseEnding = "GridRequest_ResponseEnding";
 
    contextMenu.LinkedControlClientId = ServerRequest.ClientID;
    contextMenu.OnClientItemClicked = "GridContextMenu_ActionsHandler";
    CreateContextItems(contextMenu.Items, this.Frame.ViewFrameData.ActionItems);
    this.Grid.MenuId = contextMenu.ID;
}
 
private void InitGridControl()
{
    this.Grid.Culture = CultureInfo.CurrentUICulture;
    this.Grid.PageSize = ApplicationConfig.Instance.ViewFormConfig.DefaultPageSize;
    this.Grid.AllowPaging = true;
    this.Grid.AllowSorting = true;
    this.Grid.AllowFilteringByColumn = true;
    this.Grid.AutoGenerateColumns = false;
    this.Grid.GroupingEnabled = false;
    this.Grid.ShowGroupPanel = false;
    this.Grid.GridLines = GridLines.None;
    this.Grid.AllowMultiRowSelection = true;
 
    this.Grid.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;
    this.Grid.PagerStyle.AlwaysVisible = true;
 
    this.Grid.ClientSettings.AllowColumnsReorder = true;
    this.Grid.ClientSettings.ColumnsReorderMethod = GridClientSettings.GridColumnsReorderMethod.Reorder;
    this.Grid.ClientSettings.EnableAlternatingItems = false;
    this.Grid.ClientSettings.EnablePostBackOnRowClick = true;
    this.Grid.ClientSettings.EnableRowHoverStyle = true;
    this.Grid.ClientSettings.ReorderColumnsOnClient = true;
    this.Grid.ClientSettings.Resizing.AllowColumnResize = true;
    this.Grid.ClientSettings.Resizing.AllowRowResize = false;
    this.Grid.ClientSettings.Resizing.AllowResizeToFit = true;
    this.Grid.ClientSettings.Resizing.EnableRealTimeResize = true;
    this.Grid.ClientSettings.Resizing.ResizeGridOnColumnResize = true;
    this.Grid.ClientSettings.Resizing.ClipCellContentOnResize = true;
    this.Grid.ClientSettings.Selecting.AllowRowSelect = true;
    this.Grid.HeaderStyle.Wrap = false;
    this.Grid.ItemStyle.Wrap = false;
    this.Grid.MasterTableView.IsFilterItemExpanded = false;
    this.Grid.MasterTableView.TableLayout = GridTableLayout.Auto; // GridTableLayout.Fixed;
    this.Grid.MasterTableView.DataKeyNames = new[]
                                            {
                                                Frame.ViewFrameData.KeyFieldName
                                            };
    this.CreateColumns();
 
    if (string.IsNullOrEmpty(this.Grid.DataSourceID))
    {
        this.Grid.NeedDataSource += this.Grid_NeedDataSource;
    }
 
    this.Grid.ItemCommand += Grid_ItemCommand;
    this.Grid.SelectedIndexChanged += Grid_SelectedIndexChanged;
    this.Grid.DataBound += Grid_DataBound;
    this.Grid.DataBindingWithArgument += Grid_DataBindingWithArgument;
    this.Grid.GetCustomText += Grid_CustomText;
    this.Grid.ItemEvent += Grid_ItemEvent;
}

As you can see the code is fairly complex, but we really need it to be solved. If you need more details, please let me know.
0
Radoslav
Telerik team
answered on 06 Mar 2013, 07:26 AM
Hi Goran,

From the provided code snippet I saw that you add RadGrid control into the UpdatePanel with ID=”PostbackPanel”:
this.PostbackPanel.ContentTemplateContainer.Controls.Add(this.Grid);
Could you please try adding the RadGrid into the ContentPanel instead of in PostbackPanel and let me know if the issue still persists.

Looking forward for your reply.

Regards,
Radoslav
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
Goran
Top achievements
Rank 1
answered on 06 Mar 2013, 08:04 AM
I've changed the code to be as following:

//this.PostbackPanel.ContentTemplateContainer.Controls.Add(this.Grid);
this.ContentPanel.Controls.Add(this.Grid);

But, there's an error now:

Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

There's no enableEventValidation or EnableEventValidation settings at all. But, if I add it in web.config file:

<pages validateRequest="false" enableEventValidation="false">

It doesn't work as well.

How can I fix this?
0
Goran
Top achievements
Rank 1
answered on 11 Mar 2013, 04:15 AM
Could someone help with this issue, please?
0
Radoslav
Telerik team
answered on 11 Mar 2013, 07:43 AM
Hi Goran,

The reported exception is a bit general and on the following threads you can find more information about it:
http://www.codeproject.com/Questions/309426/Error-Invalid-postback-or-callback-argument-when-I
http://stackoverflow.com/questions/228969/invalid-postback-or-callback-argument-event-validation-is-enabled-using-page
http://stackoverflow.com/questions/7476329/asp-net-invalid-postback-or-callback-argument
http://forums.asp.net/t/1724183.aspx/1
http://channel9.msdn.com/Forums/TechOff/155642-Invalid-postback-or-callback-argument-Wants-event-validation-enabled

I hope this helps.

Greetings,
Radoslav
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
Goran
Top achievements
Rank 1
answered on 13 Mar 2013, 07:18 AM
If I understood you correctly, the problem here is the fact that Ajax was enabled that is Ajax prevents saving dialog to show up. If so how can we overcome this situation that is to have grid Ajax capability and saving dialog showed?
0
Goran
Top achievements
Rank 1
answered on 14 Mar 2013, 10:48 AM
Even if I set:

EnableAJAX="false"

export/saving dialog doesn't show up.

What else can prevent showing of export/saving dialog?
0
Radoslav
Telerik team
answered on 15 Mar 2013, 07:53 AM
Hello Goran,

Any ajax or server side error can prevent showing of export/saving dialog. Could you please verify that there is not any server side error when you tried to export the RadGrid. Also in conjunction with setting the EnableAJAX="false" to all RadAjaxManagers or RadAjaxPanels, could you please try removing all asp:UpdatePanels from your pages and let me know if the issue still persists.

Looking forward for your reply.

All the best,
Radoslav
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
Grid
Asked by
Goran
Top achievements
Rank 1
Answers by
Goran
Top achievements
Rank 1
Radoslav
Telerik team
Share this question
or