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

Disabling rows to be exported according to a condition

1 Answer 65 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ueli
Top achievements
Rank 2
Ueli asked on 30 May 2014, 06:10 PM
Hi,

I just wonder whether it would be directly possible to have certains rows not exported based on a condition I set or whether I need to exclude them manually.

Ueli

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 31 May 2014, 07:05 AM
Hi Ueli,

Thank you for writing.

To exclude a row from being exported, you need to set its IsVisible property to false and the exporter's HiddenRowOption to DoNotExport:
private void radButton1_Click(object sender, EventArgs e)
{
    ExportToExcelML exporter = new ExportToExcelML(this.radGridView1);
    exporter.HiddenRowOption = HiddenOption.DoNotExport;
  
    string fileName = "C:\\ExportedData123.xls";
  
    foreach (var item in radGridView1.Rows)
    {
        item.IsVisible = false;  
    }
  
    exporter.RunExport(fileName);
  
    foreach (var item in radGridView1.Rows)
    {
        item.IsVisible = true;
    }
}

I hope this helps.

Regards,
Stefan
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
Ueli
Top achievements
Rank 2
Answers by
Stefan
Telerik team
Share this question
or