Hi,
We are exporting our datagrid to excel and would like to remove duplicate rows before that.
Is there any way to do this?
Thanks,
Neha.
Using the same grid users can make multiple exports. Each export can have different set of rows hidden. Hence we would find it useful if we could unhide all the rows before every export.
We are not using the InitializeRow and hence I guess looping through the rows is a solution.
Thanks for your help!
~ Neha.
Hi Neha,
I'm not sure I understand. If you are hiding the rows in the InitializeRow event of the ultraGridExcelExporter, like I suggested, then the rows in the actual grid will not be hidden, it will only affect the export. These rows no longer exist after the export is completed, so there's no reason for you to ever need to re-show them. Then next time you export, you can simply not hide them.
If you are hiding rows in the on-screen grid and you are doing it outside of InitializeRow, then you will have to loop through the rows to make them visible again. If you are using InitializeRow, you could just set a flag and call grid.Rows.Refresh(FireInitializeRow) to force the rows to be refreshed.
Hey Mike,
Thanks for your response.
I used your suggestion to hide rows. Now, I realise that I also need a way to unhide ALL rows. I am unable to find a way to do this unless I loop through each row and set Hidden property to false.
Any suggestions would be most appreciated since we have around 8000 rows and looping through all will take a while...
Thanks again,
There's nothing in the grid to do this for you.
The approach I would take would be something like this: