Oct 08, 2008, 6:14 PM
Add Gridpanel to an Tabpanel in Runtime. BUG?
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.
In my tabpanel, i added Ajaxevents when user changes tab.
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?
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" >
<AjaxEvents>
<TabChange OnEvent="mudaDataBind" EventMask-Msg="Obtendo lista de atividades..." EventMask-ShowMask="true">
</TabChange>
</AjaxEvents>
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");
Store1.DataBind();
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?