PDA

View Full Version : [CLOSED] Runtime error in abstract component .cs



feanor91
Apr 18, 2012, 9:16 AM
Hello

when running my application I have this error :

"Ext.Net.Toolbar cannot use content"


on the line


return this.ContentContainer.ClientID;



in this function


/// <summary>
/// The id of an existing HTML node to use as the panel's body content (defaults to '').
/// </summary>
[ConfigOption]
[Category("3. AbstractComponent")]
[DeferredRender]
[DefaultValue("")]
[Description("The id of an existing HTML node to use as the panel's body content (defaults to '').")]
public virtual string ContentEl
{
get
{
if (!this.DesignMode)
{
if (this.PreventContent)
{
return "";
}

if (!this.ContentContainer.Visible)
{
return "";
}

if (this.Content == null && this.ContentControls.Count == 0)
{
this.ContentContainer.Visible = false;
return "";
}

this.ContentContainer.Visible = true;

var container = this as AbstractContainer;
if (container != null && this.ContentControls.Count > 0 && container.Items.Count == 0 && container.Layout.IsNotEmpty())
{
return "";
}
}

if (this is INoneContentable)
{
throw new Exception(this.GetType().ToString() + " cannot use Content");
}

return this.ContentContainer.ClientID;
}
}

Daniil
Apr 18, 2012, 10:06 AM
Hi,

It means that you cannot use Toolbar Content like this:

<ext:Toolbar runat="server">
<Content>
<ext:DisplayField runat="server" Html="Hello World!" />
</Content>
</ext:Toolbar>

Please use Items.

feanor91
Apr 18, 2012, 10:58 AM
OK, thanks, I will change content by items.

Could you give more explanation about that point just to understand what happened? And for other controls where I could use content in place of items, it will be the same behavior?

Daniil
Apr 18, 2012, 11:15 AM
Well, Toolbar doesn't support Content due to its destination. It should contain only Ext.Net.Components.

You can still use Content of Container, Panel, Window.

feanor91
Apr 18, 2012, 11:24 AM
Thanks a lot.

At least I have a squeleton of my application that run now. I have the desktop but no items in start menu...I have to go deeper to see what happened.