Exporting GridView Data using the Toolbar in an MVVM Pattern

4 posts, 0 answers
  1. Kingsley Magnus-Eweka
    Kingsley Magnus-Eweka avatar
    54 posts
    Member since:
    Aug 2009

    Posted 10 Nov 2011 Link to this post

    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
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 15 Nov 2011 Link to this post

    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 >>

  3. DevCraft banner
  4. Kingsley Magnus-Eweka
    Kingsley Magnus-Eweka avatar
    54 posts
    Member since:
    Aug 2009

    Posted 15 Nov 2011 Link to this post

    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
  5. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 18 Nov 2011 Link to this post

    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 >>

Back to Top