Hello.
I have a code which uses a WebTab control with a couple of grids inside. Also it has options:
<PostBackOptions EnableLoadOnDemand="true" EnableAjax="true" />
WebTab has two tabs each containing WebDataGrid. Page loads with first tab enabled and first grid loads correctly, but when you click on second tab second grid does not load at all! Also after clicking second tab the second grid object is NULL in codebehind.
Also if you disable "EnableAjax" option and click tabs, the TabIndex property of WebTab is always 0 and doesn't represent actual active tab.
I have created an example application (attached) to demonstrate that strange behaviour.
As it is - you can see WebTab that doesn't load second tab.
If you set EnableAjax="false", you can:
Also i'm pretty sure that this very code worked well with version 13.1 of infragistics.
Hello Anton ,
Thank you for posting in our forum.
The SelectedIndex of the WebTab won’t change until the SelectedIndexChanged of the WebTab has been raised.
You can handle the SelectedIndexChanged event and in it check the new selected index from the event args: e.NewIndex
And based on that set the related grids data source.
Also to ensure that all templates are instantiated you can use the InstantiateTemplates() method:
this.WebTab1.InstantiateTemplates();
Before you try to access the second grid.
I’ve attached the modified sample for your reference.
Let me know if you have any questions.
Best Regards,
Maya Kirova
Developer Support Engineer II
Infragistics, Inc.
http://www.infragistics.com/support
Well, that works.
But what's the point of EnableLoadOnDemand if you still have to instantiate all the templates before accessing one of them?
You could instantiate the template for the second tab only. For example:
this.WebTab1.Tabs[1].Template.InstantiateIn(this.WebTab1.Tabs[1]);
However by default the state of the first tab is persisted in the view state so at that point of the page lifecycle the first template will also have been instantiated and created. So there won’t be any major difference.
For more details on the load on demand feature please refer to:
http://help.infragistics.com/Doc/ASPNET/2014.1/CLR4.0/?page=WebTab_Load_on_Demand.html
That helps a lot. Thank you very much!