We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Grid Export problems

Hi,

In my project, I create user controls that contains a grid dinamically. I need export to excel this grids, and I have two problems:

1- If I want set all user controls inside a update panel, the export fail. I've read this document

https://www.syncfusion.com/kb/5442/how-to-export-the-data-when-grid-is-in-updatepanel

But my grids are in a user control and I don't know how assign the trigger.

2- If I export an individual grid, it works fine, but after, if I want export all grids with the button export all, it doesn't work

I attach a demo example with my problems. In the example you must "check all" all teams and push on "Generar Informe".

Thanks

Attachment: Tab_eaab5543.zip

3 Replies

BM Balaji Marimuthu Syncfusion Team October 29, 2015 08:52 AM UTC

Hi Manolo,

Thanks for contacting Syncfusion support.

Query:1 1- If I want set all user controls inside a update panel, the export fail. I've read this document. But my grids are in a user control and I don't know how assign the trigger.

To set all user controls (Grid) inside a update pane,l we need to register the control id to postbackcontrol in page load function. Refer to the modified sample and code example as below.
Sample: Tab


[Default]

<asp:UpdatePanel runat="server" ID="updatePanel">

        <ContentTemplate>

            <div class="row">

                <asp:Panel runat="server" ID="panelReports">


                </asp:Panel>

               

            </div>

            </ContentTemplate>
    </asp:UpdatePanel>


[UserControl]

<ej:Grid ID="gridOperacionesTerminadasTipoOperacion" runat="server" AllowPaging="True" AllowFiltering="True" AllowScrolling="True" AllowSorting="True" OnServerExcelExporting="gridOperacionesTerminadasTipoOperacion_ServerExcelExporting">


. . .
            </ej:Grid>


[Usercontrol.cs]


public partial class DatosInformeGasTeam : System.Web.UI.UserControl

    {

        public Syncfusion.JavaScript.Web.Grid DataGrig { get { return gridOperacionesTerminadasTipoOperacion; } }


        protected void Page_Load(object sender, EventArgs e)

        {

            ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page);

            scriptManager.RegisterPostBackControl(this.FindControl("gridOperacionesTerminadasTipoOperacion"))//control id
        }
}


Query: 2- If I export an individual grid, it works fine, but after, if I want export all grids with the button export all, it doesn't work

We suggest you to set the ej.isOnWebForms as true in button client side onclick event. Refer to the code example as below.



<ej:Button ID="btnExportAll" runat="server" Size="Large" Type="Button" Text="Export All" ShowRoundedCorner="true" OnClick="btnExportAll_Click"  ClientSideOnClick="btnClick"/>




function btnClick(args) {

             ej.isOnWebForms = true;
         }


Refer to the demo for button clientside event: http://asp.syncfusion.com/demos/web/buttons/clientsideevents.aspx

Regards,
Balaji Marimuthu


MA Manolo October 29, 2015 12:02 PM UTC

Thanks a lot!

It works perfectly!


BM Balaji Marimuthu Syncfusion Team October 30, 2015 04:48 AM UTC

Hi Manolo,

We are happy that the provided solution helped you.

Please get back to us if you need any further assistance. We will be happy to assist you.

Regards,
Balaji Marimuthu

Loader.
Live Chat Icon For mobile
Up arrow icon