[CLOSED] Issues with default namespace when panels are rendered dynamically

  1. #1

    [CLOSED] Issues with default namespace when panels are rendered dynamically

    My Accordion menu panel is created dynamically in code and when it is about to insert the accordion in the panel I get javascript error "Microsoft JScript runtime error: 'App' is undefined" and the code stops at the code

    Ext.getCmp("westPanel").add(App.ctl27)

    I have already used the resource manager definition below for the page where the accordion will be inserted

    <ext:ResourceManager runat="server" Namespace="">
        
     </ext:ResourceManager>
    How can I assign the namespace to the accordion panel when it is been created.

    Below is the code used in creating the accordion



    
    public AjaxResult ToScript()
            {
                AjaxResult response = new AjaxResult();
     Container m_accordion= new Container() { Layout = "Accordion" };   
                MenuPanel menuPanel = null;
                NavigatorMenuItem navigatorMenuItem = null;
                for (int i = 0; i < 5; i++)
                {
    
                    menuPanel = new MenuPanel();
                    menuPanel.Border = false;
                    menuPanel.SaveSelection = false;
                    menuPanel.Cls = "white-menu";
                    menuPanel.Collapsed = false;
    
                    menuPanel.Icon = Ext.Net.Icon.ArrowMerge;
    
                    for (int g = 0; g < 4; g++)
                    {
                        MenuItem menuitem = new MenuItem();
    
                        menuitem.Icon = Ext.Net.Icon.ArrowMerge;
                        menuitem.Text = "sample" + g;
                        menuitem.CustomConfig.Add(new ConfigItem()
                                                      {Name = "passParentSize", Value = "true", Mode = ParameterMode.Raw});
                        menuPanel.Menu.Items.Add(menuitem);
    
                    }
                    menuPanel.Menu.Listeners.Click.Handler =
                        "Monitor.addTab({ title: menuItem.text, url: menuItem.url, icon: menuItem.iconCls, passParentSize: menuItem.passParentSize});";
                    m_accordion.Items.Add(menuPanel);
                }
                response.Script = m_accordion.ToScript(RenderMode.AddTo, "westPanel");
                return response;
            }
    Last edited by Daniil; Mar 13, 2012 at 5:38 PM. Reason: [CLOSED]
  2. #2
    Controller action doesn't know about namespace is defined in the page
    it is better to set global namespace (via web.config) or set the same namespace for dynamic widget
    Vladimir Shcheglov
    Sr. Developer
  3. #3
    Thanks.The namespace issiue have been resolved.

    Now I am getting the error that

    "Microsoft JScript runtime error: 'ctl27' is undefined" and the code stops at the code

    Ext.getCmp("westPanel").add(ctl27);
    This code works perfectly well in V1. I don't know what I am missing or the changes that I need to do to make it to work in V2.

    "westpanel" is the ID to a panel located on the west region of a border layout.

    Regards
    Last edited by Daniil; Mar 08, 2012 at 7:04 AM. Reason: Please use [CODE] tags
  4. #4
    Hi,

    The issue is not reproducible with latest code.
    I suggest to set explicit ID for Container
    Vladimir Shcheglov
    Sr. Developer

Similar Threads

  1. [CLOSED] dynamically control is rendered out of masterpage
    By SouthDeveloper in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Aug 10, 2011, 1:16 PM
  2. [CLOSED] Height Issues when auto loading panels
    By craig2005 in forum 1.x Legacy Premium Help
    Replies: 19
    Last Post: Mar 21, 2011, 7:04 PM
  3. [CLOSED] [0.8.2] ComboBox rendered issues
    By FVNoel in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jan 18, 2010, 2:34 PM
  4. [CLOSED] Need Help with Performance Issues - Grid Panels
    By JD in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: Dec 31, 2009, 5:56 AM
  5. Issues with dynamic IDs and tab panels
    By mindcore1 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 21, 2008, 4:41 PM

Posting Permissions