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.
Unfortunately, activation email could not send to your email. Please try again.

How to export selected rows (only if the checkbos is checked) from GGC to excel

Thread ID:

Created:

Updated:

Platform:

Replies:

104929 Aug 29,2012 07:05 AM Aug 30,2012 01:17 AM ASP.NET Web Forms (Classic) 1
loading
Tags: Grouping
varsha
Asked On August 29, 2012 07:05 AM

 

Hi,

Please let me know how to export only selected row (rows in which checkbox is checked) to excel. Please let me know what I should include(in place of  ???) in the below code to achieve the same.

protected void RecordCheck_CheckedChanged(object sender, System.EventArgs e)

{

System.Web.UI.WebControls.CheckBox checkbox1 = (System.Web.UI.WebControls.CheckBox)sender;

GridRow gridrow = (GridRow)checkbox1.Parent.Parent.Parent;

if (checkbox1 != null)

{

if (checkbox1.Checked == true)

{

GridExcelExport excel = new GridExcelExport(???, fileName);

excel.ExportNestedTable = true;

excel.Export();

}

}

 

Thanks,

Varsha


Vinish Kumar K [Syncfusion]
Replied On August 30, 2012 01:17 AM

Hi Varsha,

The following codes are used to export the selected record. ExportElement event is used to export selected record. you can change this code to your sample to achieve the check box selected records.

GroupingGridExcelConverterControl gecc = new GroupingGridExcelConverterControl();
      
        gecc.ExportElement += new GroupingGridExcelConverterControl.GridExportElementEventHandler(gecc_ExportElement);
                gecc.GroupingGridToExcel(gridGroupingControl1,  Syncfusion.GridExcelConverter.ConverterOptions.Default);

        void gecc_ExportElement(object sender, GridExportElementEventArgs e)
        {
            if (e.Element.IsRecord()  && !e.Element.GetRecord().IsSelected())
            {
                e.Cancel = true;
            }
        }

In your second query, in that ( ????) place you should use the Syncfusion control (export to excel).

Please let us know if you have any further concerns regarding this.

Regards,
Vinish Kumar

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;