473,837 Members | 1,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Frustrating problem with CollectionEdito r - 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
Editor(typeof(I mageUrlEditor). ...).
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.D esign;
using System.Web.UI.W ebControls;
using System.Componen tModel;
using System.Componen tModel.Design;
using System.Collecti ons;
using MyWebControls;

namespace MyWebControls
/// <summary>
/// Implementation of an ASP.NET Context Menu control
/// </summary>
[ToolboxData("<{ 0}:Test runat=server></{0}:Test>"),
Designer(typeof (MyDesigner)),
ParseChildren(t rue,"Items")
public class Test : System.Web.UI.W ebControls.WebC ontrol
private ItemList _items=new ItemList();

[DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Content)]
[PersistenceMode (PersistenceMod e.InnerDefaultP roperty)]
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(HtmlText Writer output)
output.WriteBeg inTag("IMG");
output.WriteAtt ribute("src",It ems[0].ItemIcon);
output.WriteEnd Tag("IMG");
base.Render(out put);



public class MyDesigner : ControlDesigner
#region Overriden methods

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

#region Menu Items Class and The Menu Items Collection

[ToolboxItem(fal se)]
public class TestItem : Control
private string iconUrl=string. Empty;

[Editor(typeof(S ystem.Web.UI.De sign.ImageUrlEd itor),
typeof(System.D rawing.Design.U ITypeEditor))]
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(TestIte m 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(TestIt em 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 1567

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Buzz Bonner | last post by:
Hi, I need to perform some validation on the items inserted into the CollectionEditor. How can I override the CollectionEditor OK button so that the editor doesn't close if a validation error is raised?
by: Lucas Sain | last post by:
Hi, I'm trying to create a property in a class that should be apepar as dropdown combo at design time with X options. Something like the WindowStateProperty where you can select 3 options. How can this be done I've tried several ways but can't get it to work. Whta am I doing wrong?. This is what I have in the class private ComboBox fieldType= new ComboBox(); private DataTable dtFieldType;
by: Vlado Brlečić | last post by:
Hello everyone! Can anyone tell me where can I catch the closing of CollectionEditorForm? I would like to do something after all items are added in collection and ok button on collectionEditor's form is pressed. I tried in CollectionBase's overrides OnInsert, and OnInsertComplete but they are called for each item. I hope I was clear enough. Thanks in advance, Vlado
by: Benny Raymond | last post by:
I'm working on a program that has a treeview, and each tree node refrences a row in my database. I really like how the properties section of the collections editor looks - is this a control that is available to use? I thought it was a datagrid, but I can't get the datagrid to show up like the collections properties thing. Any help would be awesome thanks! ~benny
by: AMDRIT | last post by:
Hello everyone, I have created a custom component and one of its properties is a class object with it's own properties. During runtime, I can assign values to the class object properties just fine. However, when attempting to assing default values as designtime in the propertygrid, nothing is working on the class object. I know that I am doing it wrong, any ideas what it is? Thanks in advance
by: Henry J. | last post by:
Is there a way to find the element currently selected in a CollectionEditor where a collection is displayed? For PropertyGrid one can use something like SelectedGridItems to get the currently selected property in a PropertyGrid. But I failed to find anything for the selected element in a CollectionEditor. Thanks for any tips!
by: Brannon | last post by:
I have a TypeConverter that displays an exclusive list of possible strings for a certain string property. That works great. In a different class, I have a list of strings with the same limitation. I want a CollectionEditor that will limit the string values to those of my converter and limit the list so that its entries are unique and forced to be one of my approved string values. Can somebody give me some pointers on this? It appears...
by: Bardo | last post by:
Hi all, I am having an issue with a custom CollectionEditor. My scenario is as follows: I have a base type TypeA. I also have a TypeACollection. The TypeACollection has an Editor attribute of TypeACollectionEditor. This collection editor derives from the framework CollectionEditor, passing TypeACollection in the constructor to indicate which type it deals with. I then have TypeB, which derives from TypeA, but adds specific
by: colin | last post by:
Hi, I have my property editor wich uses the pop up collection editor for arrays etc, but i have had to use a generic wrapper for the elements in some types of collections. although the editing actually works well, and I can set the name ok in the primary property editor, this makes a mess of the type name displayed in the pop up colection editor, is there any way to change this ?
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.