Export a hidden grid

1 Answer 145 Views
Grid
Dean
Top achievements
Rank 1
Iron
Iron
Veteran
Dean asked on 21 Oct 2021, 04:42 PM

Is there a way to hide a grid on the page, but still allow for export to Excel the "easy way" - using the ExportToExcel command?

For example, can this command be called by another button?

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 23 Oct 2021, 11:51 AM

Hello Dean,

If you hide a grid the Blazor way (e.g., an @if(condition){<Grid>}, it will not render at all and so it could not be exported.

If you hide it with CSS alone, that might work, but it is a bit of an overkill. You may want to Vote for and Follow this enhancement idea for a programmatic export call, but it will still require a grid to be instantiated. If you don't want the grid, I can suggest you generate the exportin you separate application code, the Document Processing Libraries we offer let you do that. You can find a basic example here.

Regards,
Marin Bratanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Dean
Top achievements
Rank 1
Iron
Iron
Veteran
commented on 26 Oct 2021, 11:14 AM

What's the CSS way of hiding it?  Do you have an example?
Marin Bratanov
Telerik team
commented on 26 Oct 2021, 06:27 PM

Just set a Class to it and in it - the display:none; rule
Dean
Top achievements
Rank 1
Iron
Iron
Veteran
commented on 27 Oct 2021, 03:05 PM

Sorry if I'm missing something but I get an error when adding a class to either a TelerikGrid or a GridColumn - it says it's not allowed.  I'm a couple of versions behind, has this been added recently?
Tags
Grid
Asked by
Dean
Top achievements
Rank 1
Iron
Iron
Veteran
Answers by
Marin Bratanov
Telerik team
Share this question
or