PDA

View Full Version : [CLOSED] Issues with default namespace when panels are rendered dynamically



RCM
Mar 07, 2012, 9:14 PM
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;
}

Vladimir
Mar 07, 2012, 10:31 PM
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

RCM
Mar 07, 2012, 11:48 PM
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

Vladimir
Mar 08, 2012, 5:00 PM
Hi,

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