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

Loading data into grid when not 'Loaded' on a tab

2 Answers 57 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Charles
Top achievements
Rank 1
Charles asked on 22 Nov 2011, 05:33 PM
Hi all, 
 I have an export window which users can access when looking at a page which can contain many grids on different tabs. I want the users to be able to visit the page and click an 'export' button to choose which grid to export data from without needing to click into each tab to show the grid first. At the moment if the user clicks on the export button, every grid is "empty" (the ItemsSource has been set but the HasItems property is false)

I'm guessing this is because the grid is on a tab which is not yet visible and has not actually fired the Loaded event and set itself up.

Is there any way I can query the grid and use the grid.Export functionality without the grid firing it's loaded event, or alternatively, force the grid to load its data (it will work fine with my form as it's bound to Grid.HasItems and should refresh once the data is loaded) without needing to be made visible?

Thanks in advance,
Charles

2 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 23 Nov 2011, 07:36 AM
Hello,

 The grid in the second tab is not initialized, not bound, etc. I'm afraid that the only way yo achieve your goal will be a bit hackish - call manually ApplyTemplate() for non initialized UI elements. 

Kind regards,
Vlad
the Telerik team

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

0
Charles
Top achievements
Rank 1
answered on 23 Nov 2011, 10:48 AM
Hi Vlad,
    That worked fine - I thought it would be something simple as calling a method to initialise the grid. Since I pass each grid into a generic export form, calling ApplyTemplate manually wasn't a problem

Thanks!
Tags
GridView
Asked by
Charles
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Charles
Top achievements
Rank 1
Share this question
or