Add Gridpanel to an Tabpanel in Runtime. BUG?

  1. #1

    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.

    
    
    
    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?

  2. #2

    RE: Add Gridpanel to an Tabpanel in Runtime. BUG?

    *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.
  3. #3

    RE: Add Gridpanel to an Tabpanel in Runtime. BUG?

    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.


    Geoffrey McGill
    Founder
  4. #4

    RE: Add Gridpanel to an Tabpanel in Runtime. BUG?

    @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?
    Last edited by geoffrey.mcgill; Feb 22, 2011 at 2:56 AM.

Similar Threads

  1. TabPanel : Add Panel in runtime
    By megang in forum 1.x Help
    Replies: 0
    Last Post: Jun 13, 2012, 9:43 AM
  2. TabPanel : Add Panel in runtime
    By megang in forum 1.x Help
    Replies: 0
    Last Post: Jun 13, 2012, 9:34 AM
  3. Replies: 1
    Last Post: May 09, 2012, 7:08 PM
  4. Replies: 11
    Last Post: Aug 27, 2010, 9:52 PM
  5. Creating GridPanel at runtime
    By methode in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Oct 21, 2008, 12:39 PM

Posting Permissions