Mar 15, 2011, 11:54 PM
[CLOSED] [1.0] Help with composite control
Hi,
I am trying to extend the DropDownField composite control but have run into an issue when adding a menu item.
When my page is rendered I get an javascript error saying that i.e. 'ctl00_MainContent_NodeBrowser_IndexList_IndexEdit or_ctl22' is undefined
Breaking into the script goes to the following line, highlighting that eval(result.script); is throwing the exception.
However, if I remove the following line from the CreateChildControl method within the composite control the error does not occur. So I would presume that the menu is the root cause of the issue.
The composite control code is as follows:
I am trying to extend the DropDownField composite control but have run into an issue when adding a menu item.
When my page is rendered I get an javascript error saying that i.e. 'ctl00_MainContent_NodeBrowser_IndexList_IndexEdit or_ctl22' is undefined
Breaking into the script goes to the following line, highlighting that eval(result.script); is throwing the exception.
var task=new Ext.util.DelayedTask(function(o,result,response){if(result.script&&result.script.length>0){(function(o,result,response){eval(result.script);}).call(window,o,result,response);}
However, when I browse the source html the control is defined: {
id: "ctl00_MainContent_NodeBrowser_IndexList_IndexEditor_russMatrixTest",
xtype: "netdropdown",
fieldLabel: "Risk Matrix Test",
width: 300,
component: {
id: "ctl00_MainContent_NodeBrowser_IndexList_IndexEditor_ctl18",
xtype: "panel",
items: {
id: "ctl00_MainContent_NodeBrowser_IndexList_IndexEditor_ctl20",
xtype: "netmenupanel",
menu: {
id: "ctl00_MainContent_NodeBrowser_IndexList_IndexEditor_ctl22",
xtype: "menu",
items: {
id: "ctl00_MainContent_NodeBrowser_IndexList_IndexEditor_menumenuitem",
text: "russ"
},
floating: false
}
Now if i extract virtually all the layout code out of our project and into a demo site the error does not occur and the composite DropDownField functions as expected.However, if I remove the following line from the CreateChildControl method within the composite control the error does not occur. So I would presume that the menu is the root cause of the issue.
masterPanel.Items.Add(menuPanel);
I understand that you will not be able to reproduce this locally but any pointers you could give in what to investigate next would be great.The composite control code is as follows:
public class RiskMatrix : Ext.Net.DropDownField
{
protected override void CreateChildControls()
{
this.Controls.Clear();
base.CreateChildControls();
Panel masterPanel = new Panel();
this.Width = 300;
this.Component.Add(masterPanel);
masterPanel.Width = 300;
masterPanel.Height = 80;
masterPanel.Layout = "column";
MenuPanel menuPanel = new MenuPanel();
menuPanel.Border = false;
menuPanel.ColumnWidth = 0.33;
menuPanel.SaveSelection = false;
masterPanel.Items.Add(menuPanel);
menuPanel.Menu.Items.Add(new MenuItem("russ"));
}
/// <summary>
///
/// </summary>
[Category("0. About")]
[Description("")]
public override string XType
{
get
{
return "netdropdown";
}
}
/// <summary>
///
/// </summary>
[Category("0. About")]
[Description("")]
public override string InstanceOf
{
get
{
return "Ext.net.DropDownField";
}
}
}
Last edited by Daniil; Mar 16, 2011 at 10:26 AM.
Reason: [CLOSED]