How to implement a simple collection editor for my control?

S

Showjumper

Hi,

I have a server control that has an arraylist which holds allowed file
types. I want to implement a simple collection editor like the one in the
dropdownlist control so that I can I add more file types as needed. Any tips
on how to do this or even a code sample would be appreciated. Thanks.
 
T

Teemu Keiski

Hi,

collection editor provides the basic functionality to edit a property of
type IList. So therefore by default you only have to provide a typed
interface so that collection becomes editable. Some discussion related to
collection implementation & IList: http://aspalliance.com/32

But to allow the collection to hold more than one type you of course need to
ensure that the collection allows these (two types which have common base
type the collection exposes). Then you implement a collection editor (class
that inherits from System.ComponentModel.Design.CollectionEditor) in which
you override CreateNewItemTypes method that returns the supported types as
Type array. Then associate the editor with the collection.
--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist





Hi,

I have a server control that has an arraylist which holds allowed file
types. I want to implement a simple collection editor like the one in the
dropdownlist control so that I can I add more file types as needed. Any tips
on how to do this or even a code sample would be appreciated. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top