View Full Version : Add Gridpanel to an Tabpanel in Runtime. BUG?

Oct 08, 2008, 7:14 PM
Hey everybody!

I have an tabpanel with 3 tabs. In this page I also have and Gridpanel.

I want to put this same grid inside a active tab in tabpanel, just changing the Datasource of a Store that is associated to my Gridpanel.

To do this, i constructed and store, and grid and an tabpanel and added ajaxevent to handle the tab change. When user change tab, I reload the Store with new values, update the grid and put my grid inside a active tab.

For first time loandig page, i put the grid inside the first tab

On Page_Load i'm doing this.

protected void Page_Load(object sender, EventArgs e)


if (!Ext.IsAjaxRequest)


Dados atividades = new Dados("connectionstring");

Store1.DataSource = atividades.GetData("SELECT field1,field.. FROM myTable");Store1.DataBind();

TabPanel1.ActiveTab.ContentControls.Add(GridPanel1 ); //at this line, i add my gridpanel to a active tab (first tab)


In my tabpanel, i added Ajaxevents when user changes tab.

<ext:TabPanel ID="TabPanel1" runat="server"

ActiveTabIndex="0" >

<TabChange OnEvent="mudaDataBind" EventMask-Msg="Obtendo lista de atividades..." EventMask-ShowMask="true">


The code in server side

public void mudaDataBind(object sender, AjaxEventArgs e)


Dados atividades = new Dados("semanaacademica");

Store1.DataSource = atividades.GetData("SELECT field1,field.. FROM myTable");


TabPanel1.ActiveTab.ContentControls.Add(GridPanel1 ); // this line is not working


My problem 1: First time user loads page, my grid appear inside first tab. When user change the tab, the method mudaDataBind is called, but my grid does not appear inside a new selected tab!

My second problem: when i rund page ("View in Browser", inside Visual Studio) its load ok. But when i try to build the website some erros are showed: The name 'TabPanel1' does not exists in current context. The same thing occoured when i was trying to use a coolite label. I face this problem when i was trying to build website to publish an example of "My Problem 1" to post here.

Im doing something wrong? Its a bug?

Oct 09, 2008, 12:25 AM
 Can you post some of your code containing the GridPanel, Store and Reader; I believe the reason that the GridPanel control isn't showing up in your tab is because they aren't connected properly. I had a similar problem due to a typo.

Oct 09, 2008, 12:38 AM
Hi caiomarqes,

I believe the issue is caused within the mudaDataBind Event. 

With the current version of the Coolite Toolkit, during an AjaxEvent you can not create and return a new toolkit control. The code will work (no exception thrown), but nothing will appear to change in the browser. 

The control must be added to the page on initial page_load. 

Hope this helps.

Oct 09, 2008, 9:48 AM
@mindcore1: my grid panel works correctely outsite tabpanel.

@geoffrey.mcgill : i think it means that i have to create 3 diferents gridpanels and put them inside each tab on page_load?

Whats about my compilation problem? Any ideas?