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

Exporting GridView Data using the Toolbar in an MVVM Pattern

3 Answers 91 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Kingsley Magnus-Eweka
Top achievements
Rank 1
Kingsley Magnus-Eweka asked on 10 Nov 2011, 12:04 PM
Hi Chaps,
Can you please let me know if it is possible to use the export functionality of the GridView Control in the toolbar control - That is to have the export function happen from an icon in the toolbar control and also  can this be done in an MVVM way so that there is a clean seperation of communication (using commanding and messages as opposed to having the export function in the code behind)from the toolbar in the view and the ViewModel where the request for the export should be handled ? we have set up our solution using Prism MVVM Pattern.
if possible can you please provide some sample code on how to do this.

kind regards
Kingsley

3 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 15 Nov 2011, 12:00 PM
Hi Kingsley Magnus-Eweka,

 The RadGridView can export its data, but what are you going to export from the RadToolBar? Usually, RadToolBar is used to contain a Buttons,ComboBoxes, ColorPickers, Galleries, HyperlinkButtons etc.
Could you please elaborate more on your feature request, what do you need to export ? Thank you  in advance for your cooperation. 

Regards,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Kingsley Magnus-Eweka
Top achievements
Rank 1
answered on 15 Nov 2011, 12:47 PM
Hi Peter,
ok let me explain we are basically creating several screens and most of them need to have a Grid that has a column with a treeview control in the cell, on the rows of the Grid, clicking the treeview control in a cell of a row will reveal a nested Grid (master/Detail style or Parent/Child relationship style) connected to that parent Row of which it's Treeview control was clicked, in essence every row in the Main grid will have an associated nested /child Grid.This Master Grid will have a ToolBar on top of it where we want all generic associated functionality of the the Root(Main)Grid to be accessed from, such as Export functionality the Grid has as standard,
we want to be able to call this functionality from the toolbar.So its just a case of replicating some functionality the Grid has but in a toolbar, the idea is we want to have a Base composite Usercontrol, comprising a Base Custom ToolBar and Grid, which can be re-used across all our screens as well as can be derived from so that all of our screens that need a Grid Control can use it, and we have a common control across all screens, we want to also do this the MVVM Route we are implementing Prism and CAB Library for Silverlight for this project. hope that explains it?
regards
0
Tina Stancheva
Telerik team
answered on 18 Nov 2011, 10:05 AM
Hello Kingsley,

You can create a RadButton control in the RadToolBar. You can set the RadButton Content to an Image and bind its Command property to an 'export' command from your view model. You can follow the approach demonstrated in this demo.

Please give this a try and let us know if it works for you.

All the best,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
ToolBar
Asked by
Kingsley Magnus-Eweka
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Kingsley Magnus-Eweka
Top achievements
Rank 1
Tina Stancheva
Telerik team
Share this question
or