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

Loading controls when tab is active

2 Answers 198 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 31 Mar 2011, 02:08 AM
Hello,
In one of my pages, I have a tab control which has 5 tabs.  Each tab has several gridviews.   It takes up to 2 minutes for all controls to be bound (all data is loaded).  The performance is not acceptable in this case.

My question is:  Is there a way to load only controls in an active tab?  Others are not until the tab is selected?

Thanks
John.

2 Answers, 1 is accepted

Sort by
0
Stas
Top achievements
Rank 1
answered on 01 Apr 2011, 07:43 AM
First, you can load data in a background thread and display busy indicator during the load,
2ndly you can put content of a tab into  a separate control and subscribe to its Loaded event and load data in the handler.
3rd, you can subscribe to TabControl.SelectionChanged (PreviewSelectionChanged) events and load data in the handler..
But things become a little harder if you need logic to prevent from navigating to other tabs if current one has errors.
0
Tina Stancheva
Telerik team
answered on 04 Apr 2011, 12:05 PM
Hello John,

By default the RadTabControl creates only one ContentPresenter for the currently selected TabItem and uses it to display the content of this TabItem.

Then when you select another RadTabItem, its content is rendered in the same ContentPresenter and therefore the content of the previously selected item is removed from the visual tree.

However, I am not sure what is taking so much time to load in your case. Is the RadTabControl databound to a business collection. If it is, then perhaps you can optimize the load of the data - load only what you need to display in the selected RadTabItem since the control won't create the content of each RadTabItem on load - only the selected content will be loaded.

Also Stas's suggestions can further help you optimize the performance of the control. If this information doesn't help or we are missing something, please elaborate on your scenario a bit more. If you can send us a sample project we will gladly look into the performance of the control in your case.

Kind regards,
Tina Stancheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
TabControl
Asked by
John
Top achievements
Rank 1
Answers by
Stas
Top achievements
Rank 1
Tina Stancheva
Telerik team
Share this question
or