Accessing Child controlls contained in IFRAME from its Parent.

  1. #1

    Accessing Child controlls contained in IFRAME from its Parent.

    Am new to the Ext.NET community and I have a question. I created a ribbon style menu with a child tab panel set in IFRAME mode. The child tab contains a grid panel and I want to have a click event in the parent insert an empty row in the grid panel in the child. Is this even possible. Thank you.

    //This piece of code is contained in the Parent  (the tab panel in the parent has id 'mainTabPanel')
    Cell AppendCell = new Cell();
    Ext.Net.Button AppendCellBtn = new Ext.Net.Button { Text = "Append", Icon = Ext.Net.Icon.Accept, Scale = ButtonScale.Small };
    AppendCellBtn.DirectClick += new ComponentDirectEvent.DirectEventHandler(AppendCellBtn_DirectClick);
    AppendCell.Items.Add(AppendCellBtn);
    
    //append row to gridpanel contained in the active child tab
     void AppendCellBtn_DirectClick(object sender, DirectEventArgs e)
    {
                TabPanel component = (TabPanel)Ext.Net.X.GetCmp("mainTabPanel");
                foreach (ContainerBase xcm in component.Items)
                {
                     Panel childPanel = (Panel)xcm;  //this always default to the first tab and not the currently active 
                     foreach( ContainerBase contrls in childPanel.Items)
                     {
                        ../// this does not work
                     }
               }
    }

    I also attempted doing this from javascript by substituting "
    AppendCellBtn.DirectClick " with "AppendCellBtn.Listeners.Click.Handler = "MainWnd.appendGridRow();"
    . Below is the javascript function.
     appendGridRow: function () {
            var pagePane = Ext.getCmp('componentMasterPn');  // I keep getting null value for pagePane because the childgridepane could not be found.
        }
    I would appreciate any help anyone could offer me. Thank you.
    Last edited by Daniil; Mar 26, 2012 at 6:08 PM. Reason: Please use [CODE] tags
  2. #2
    Hi,

    Welcome to Ext.NET!

    Please see:
    https://examples1.ext.net/#/Panel/Ba...Communication/

    You can access a child page controls in code behind, because there is another page instance. But you can generate a respective JavaScript from code behind to be executed on client.
  3. #3
    Thank you for your response. i have reviewed the link several times. So are you saying that a Parent cannot access a child controll period. i have a button in the parent and the active tab is the child. So essentially the instance of the child is unknown hence the parent will not be be able to access the child control?
  4. #4
    You can't access the iframe controls from a parent page. And otherwise - you can't access the parent controls from an iframe page. It's all about code behind.

    Can you provide a simplified example which would demonstrate your requirement?
  5. #5
    Thank you Danill, I appreciate your prompt response once again. My requirement is to create an application with accordion navigation to the left and a ribbon style menutabs on top and the main application in the center like the image depicted below:
    Click image for larger version. 

Name:	ribbon.png 
Views:	254 
Size:	47.6 KB 
ID:	4000

    click the button from the navigational menu triggers a page to load into the center. The page loaded in the center is loaded using IFRAME mode. The requirement is by clicking the ribbon menu, the loaded page grid rows should be affected. Judging from the images above, is there another option of accomplishing this task without the use of the Ifram tabs?

    Thank you.
  6. #6
    Well, iframes are not required, but, probably, they are good in your case.

    I would also look into a possibility to use XRender - rendering controls on the fly during DirectEvent.
    https://examples1.ext.net/#/XRender/Basic/Add_Items/
    https://examples1.ext.net/#/XRender/Basic/New_Window/

Similar Threads

  1. Replies: 7
    Last Post: Feb 09, 2012, 11:17 AM
  2. [CLOSED] accessing buttons in child panels
    By GLD in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jun 17, 2011, 12:48 PM
  3. [CLOSED] Accessing Parent from Iframe
    By stoque in forum 1.x Legacy Premium Help
    Replies: 18
    Last Post: Jun 03, 2011, 9:10 PM
  4. Replies: 1
    Last Post: Apr 26, 2011, 6:49 PM
  5. [CLOSED] Communication between parent and child IFRAME with Autoload
    By bakardi in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Feb 24, 2011, 2:09 PM

Posting Permissions