Custom webcontrol with reference to another one

Discussion in 'ASP .Net Building Controls' started by iontichy, Jan 18, 2007.

  1. iontichy

    iontichy Guest

    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,
    iontichy, Jan 18, 2007
    1. Advertisements

  2. 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; }
    Nathaniel Greene, Jan 20, 2007
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.