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

how can i add export buttons to dynamically created grid

3 Answers 145 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Saadettin
Top achievements
Rank 1
Saadettin asked on 09 Oct 2013, 01:54 PM
Hi. I added a telerik radgrid to my aspx page. Then I add values dynamically to it. I create a Datatable , and I add datas to it. After that, I set radgrid's datasource to datatable. It works good. Now I need to show export to excel, pdf buttons on this grid,, and export this datas to excel, word. How can I add export buttons and run thme  in dynamically created grid. Thanks in advance.

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 10 Oct 2013, 05:08 AM
Hi ,

Please add the following code snippet to your code to add export buttons to the grid.

C#:
RadGrid1.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
RadGrid1.MasterTableView.CommandItemSettings.ShowExportToExcelButton = true;
RadGrid1.MasterTableView.CommandItemSettings.ShowExportToWordButton = true;
RadGrid1.ExportSettings.IgnorePaging = true;

Thanks,
Shinu
0
Saadettin
Top achievements
Rank 1
answered on 10 Oct 2013, 06:53 AM
Thanks Shinu. I also ask one more question. I guess, I will write some codes for exporting data, wont I? 
Now I did not write any code for exprot process. I click excel(or word) button, then my grid disappears? Why this can happen?
Thanks again...
0
Shinu
Top achievements
Rank 2
answered on 11 Oct 2013, 03:36 AM
Hi ,

Make sure that you are binding the RadGrid using the Advanced Data-binding (using NeedDataSource event).
Additionally, note that you should disable Ajax upon export, as for the export to work properly, a regular postback is required.
If this doesn't help,please provide your full code snippet.

Thanks,
Shinu
Tags
Grid
Asked by
Saadettin
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Saadettin
Top achievements
Rank 1
Share this question
or