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

Grid within the UpdatePanel, I can not export

2 Answers 98 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rudá Cunha
Top achievements
Rank 2
Rudá Cunha asked on 10 Sep 2010, 09:26 PM
I'm changing the gridview by RadGrid and am using the export feature (the same site http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/exporting/defaultcs.aspx example, the buttons on the same grid and with all three options checked:
Export only date
Ignore paging (exports all pages)
Open Exported data in new browser window

Except that when I put on my pages, I realized that the export does not work when you have the UpdatePanel.

How do I fix this?

2 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 10 Sep 2010, 09:45 PM
Hello Rudá Cunha da Silva,

Please examine the following links:
Export from ajaxified grid
Export RadGrid content to Excel/Word/CSV/PDF with Ajax enabled
Exclude controls from ajaxifying

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
0
Rudá Cunha
Top achievements
Rank 2
answered on 12 Sep 2010, 04:19 PM
As you have not solved the problem directly in the component of the UpdatePanel.
So to avoid having to put in all my paintings OnItemCreated the event, I created a component inheriting the RadGrid, giving an override in OnItemCreated:


    [ToolboxData("<{0}:Grid runat=server></{0}:Grid>")]
    [Designer("Telerik.Web.Design.RadGridDesigner, Telerik.Web.Design, Culture=neutral")]
    public class Grid : Telerik.Web.UI.RadGrid
    {
        public Grid()
            : base()
        {
        }

        protected override void OnItemCreated(Telerik.Web.UI.GridItemEventArgs e)
        {
            if (!DesignMode)
            {
                if (e.Item is GridCommandItem)
                {
                    Control bt;

                    if (MasterTableView.CommandItemSettings.ShowExportToExcelButton)
                    {
                        bt = (e.Item as GridCommandItem).FindControl("ExportToExcelButton");

                        if (bt != null)
                            ScriptManager.RegisterPostBackControl(bt);
                    }

                    if (MasterTableView.CommandItemSettings.ShowExportToWordButton)
                    {
                        bt = (e.Item as GridCommandItem).FindControl("ExportToWordButton");

                        if (bt != null)
                            ScriptManager.RegisterPostBackControl(bt);
                    }

                    if (MasterTableView.CommandItemSettings.ShowExportToPdfButton)
                    {
                        bt = (e.Item as GridCommandItem).FindControl("ExportToPdfButton");

                        if (bt != null)
                            ScriptManager.RegisterPostBackControl(bt);
                    }

                    if (MasterTableView.CommandItemSettings.ShowExportToCsvButton)
                    {
                        bt = (e.Item as GridCommandItem).FindControl("ExportToCsvButton");

                        if (bt != null)
                            ScriptManager.RegisterPostBackControl(bt);
                    }
                }
            }

            base.OnItemCreated(e);
        }
    }

It's time to put this code directly in RadGrid!
Tags
Grid
Asked by
Rudá Cunha
Top achievements
Rank 2
Answers by
Daniel
Telerik team
Rudá Cunha
Top achievements
Rank 2
Share this question
or