471,853 Members | 1,805 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,853 software developers and data experts.

Frustrating problem with CollectionEditor - invoking another editor

I have a problem using the CollectioEditor.
In my custom control I have a public property that returns ItemList.
ItemList is inherited from CollectionBase and contains very simple
called "TestItem" that are inherited from Control.
i have added,To the TestItem class, a proprety called "ItemIcon",
and I added to this property the attribute
In design-time, I can access the "ItemList" property and add a
item to the collection and then change the "ItemIcon" property.
Now begins the problem:
my problem happens in 2 cases:
1)I change to html view and back to design view.
2) I simply run the application, and then return to deisgn view
(after I exit the application).

The problem is that now, when I access the "ItemList" property and try
to press on the 3 dots of the ImageUrlEditor of "ItemIcon" nothing
I really don't know how to solve this problem.
please help.

here is my code:

using System;
using System.Web.UI;
using System.Web.UI.Design;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using MyWebControls;

namespace MyWebControls
/// <summary>
/// Implementation of an ASP.NET Context Menu control
/// </summary>
[ToolboxData("<{0}:Test runat=server></{0}:Test>"),
public class Test : System.Web.UI.WebControls.WebControl
private ItemList _items=new ItemList();

[DesignerSerializationVisibility(DesignerSerializat ionVisibility.Content)]
[PersistenceMode(PersistenceMode.InnerDefaultProper ty)]
public ItemList Items
get {return _items; }

/// <summary>
/// Render this control to the output parameter specified.
/// </summary>
/// <param name="output"> The HTML writer to write out to </param>
protected override void Render(HtmlTextWriter output)



public class MyDesigner : ControlDesigner
#region Overriden methods

/// <summary>
/// Returns HTML code to show in designer
/// </summary>
public override string GetDesignTimeHtml()
return "<div style=\"padding:2px; background-color:
ButtonFace;color:ButtonText; "+
"border-style:outset; border-width:1px; font: 75% 'Microsoft Sans
"Test Control</b> - "+((Control)Component).ID+"</div>";

#region Menu Items Class and The Menu Items Collection

public class TestItem : Control
private string iconUrl=string.Empty;

[Editor(typeof(System.Web.UI.Design.ImageUrlEditor) ,
public string ItemIcon
get { return iconUrl; }
set { iconUrl=value; }

public TestItem()

public class ItemList : CollectionBase

public TestItem this[int Index]
return (TestItem) List[Index];

public int Add(TestItem value )
return( List.Add( value ) );
public int IndexOf(TestItem value )
return( List.IndexOf( value ) );

public void Insert( int index, TestItem value )
List.Insert( index, value );

public void Remove(TestItem value )
List.Remove( value );

public bool Contains(TestItem value )
// If value is not of type TestItem, this will return false.
return( List.Contains( value ) );

protected override void OnInsert(int index, object value)
base.OnInsert (index, value);


Nov 18 '05 #1
0 1484

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Buzz Bonner | last post: by
1 post views Thread by Lucas Sain | last post: by
reply views Thread by Vlado Brleèiæ | last post: by
reply views Thread by NeoPa | last post: by
reply views Thread by YellowAndGreen | last post: by
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.