all groups > asp.net building controls > january 2007 >
You're in the

asp.net building controls

group:

Custom webcontrol with reference to another one


Custom webcontrol with reference to another one iontichy
1/18/2007 12:18:16 PM
asp.net building controls:
Hi,
I've been working on a custom webcontrol with a property that
references another webcontrol from the same page.
In my special test case I have a Person_firstname1 control and a
PersonSource1 control. The Person_firstname1 have a property of the
type PersonSource. Now i want to assign the this property in the visual
studio designer. How could I persuade the designer, to show a dropdown
list of the controls in the page with the correct type (e.g.
PersonSource1, PersonSource2 etc.)

Thanks in advance,
Mirko
RE: Custom webcontrol with reference to another one Nathaniel Greene
1/19/2007 10:44:01 PM
Hello,
You would want to use the
IDReferenceProperty attribute
Seee the below code.
I created 2 classes - MailLink and ToLink. for ToLink there is a property
called Buddy that can be any MailLink. By attachign this attribute and
specifying the type then it will automagically enumerate these for you.

MailLink gBuddy;
[Browsable(true), IDReferenceProperty(typeof(MailLink))]
public MailLink Buddy
{
get { return gBuddy; }
set { gBuddy = value; }
}



[quoted text, click to view]
AddThis Social Bookmark Button