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

Want to delete row in the grid

Hi
   I am using pivot grid in my form, I want to delete active row in the grid.
please send the sample coding for my requirement
 
Regards
T.Ashokraj
 

3 Replies

NK Neelakandan Kannan Syncfusion Team October 30, 2014 12:52 PM UTC

Hi Ashokraj,

 

Thank you for your interest in Syncfusion products.

 

If you want to delete the row from Pivotgrid, you can use HideRows property. Please make use of below code,

 

this.pivotGridControl1.TableModel.HideRows[RowIndex] = true; // The row which you want to delete

 

Please let me know if I misunderstood your query.

 

Regards,

Neelakandan



AS Ashokraj October 31, 2014 04:29 AM UTC

Hi Kannan
Thanks for your reply.
 
Already i used Hiderows in my code its works perfectly but while exporting my grid to excel,Hided rows also showing in the excel so only i decided to delete that row.
please give any other solution's for my issue.
 
Thanks & Regards
T.Ashokraj


NK Neelakandan Kannan Syncfusion Team November 3, 2014 12:43 PM UTC

Hi Ashokraj,

Thank you for your update.

If you want to export the PivotGrid without hidden rows, you need to export the TableModel of the PivotGrid. Because it will export the current structure of the Pivotgrid.

Please refer the below code:

private void buttonAdv2_Click(object sender, EventArgs e)

{

SaveFileDialog savedialog = new SaveFileDialog();

savedialog.AddExtension = true;

savedialog.FileName = "Sample";

savedialog.DefaultExt = "xlsx";

savedialog.Filter = "Excel file (.xlsx)|*.xlsx";

ExcelEngine excelEngine = new ExcelEngine();

IApplication application = excelEngine.Excel;

application.DefaultVersion = ExcelVersion.Excel2010;

IWorkbook chartBook = ExcelUtils.CreateWorkbook(1);

chartBook.Version = ExcelVersion.Excel2010;

IWorksheet sheet = chartBook.Worksheets[0];

Syncfusion.GridExcelConverter.GridExcelConverterControl grid = new Syncfusion.GridExcelConverter.GridExcelConverterControl();

grid.QueryImportExportCellInfo += new Syncfusion.GridExcelConverter.GridImportExportCellInfoEventHandler(grid_QueryImportExportCellInfo);

grid.GridToExcel(this.pivotGridControl1.TableModel, sheet, Syncfusion.GridExcelConverter.ConverterOptions.Default);

chartBook.SaveAs("sample.xlsx");

Process.Start("sample.xlsx");

}

 

Note:

In the sample you can also export pivot grid without  SubTotal row. Please refer the attached sample.

 

Please let me know if you have further concerns.

 

Regards,

Neelakandan


Attachment: Pivot_Exporting_Without_subtotal_and_Row_f9ff8d63.zip

Loader.
Live Chat Icon For mobile
Up arrow icon