Home All Groups Group Topic Archive Search About

a dropdown list in the "Properties" window

Author
12 Jul 2005 11:50 PM
leodippolito
Hello sirs,


I have developed a custom webcontrol, that can be used in a webform.
The custom control inherits from TextBox webcontrol.


I need to have a public property in this custom control that will show
as a dropdown list in the "Properties" window of Visual Studio IDE.


The options for selection in this dropdown would be the
variables/objects declared in the webform, that is, the parent
container of the custom control.


My problem: I don't know how to do this.


Is there any hint, advice, sample, start point to give me?


TIA,
Leonardo

Author
13 Jul 2005 6:45 AM
Teemu Keiski
Hi,

simple way is to create a enum (enumeration) which represents these values
and have that as type of the property. It would get a selection list in
Property Browser automatically.

However, as you say that options consist of other objects on the form, then
it already requires a custom type converter and you'd apply this to be the
type converter for the property in question.

Implementing a Type Converter
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconimplementingtypeconverter.asp

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
Are all your drivers up to date? click for free checkup

Author
13 Jul 2005 10:55 AM
leodippolito
Thanks Keiski, I'll take a look at the article!
Author
14 Jul 2005 12:14 AM
leodippolito
I could implement sucessfully a TypeConverter.  If I have an ArrayList
of strings, it shows up as a dropdownlist in Visual Studio IDE.

But I don't know how to pass to the type converter class a list of
declared objects in the form that the control is placed.

Any idea?

TIA,
Leonardo
Author
14 Jul 2005 12:41 PM
leodippolito
Guess I am alone on this one.
Author
18 Jul 2005 11:27 AM
Teemu Keiski
Not exactly :-) , I'm just having vacation so responding can be slow
sometimes. :-)

Here's one example how those controls are got within a TypeConverter
http://weblogs.asp.net/asmith/archive/2003/09/04/26360.aspx

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

Bookmark and Share

Post Thread options