How to make Editor for ListItemCollection visible in VS2005 properties page?

Discussion in 'ASP .Net Building Controls' started by cpnet, Sep 10, 2007.

  1. cpnet

    cpnet Guest

    I'm trying to build a User Control in C# for ASP.NET 2.0. My user control
    contains two ListBoxes. I am exposing the Items property of each ListBox as
    public properties of my User Control. That part works ok. But, I can't get
    a collection editor to show for the items properties of my User Control.
    How can I do this? Here's what I'm trying so far:

    public ListItemCollection Items1
    return ListBox1.Items;

    I see my "Items1" property in the property page in VS2005 at design time,
    but the button to open up the collection editor is not there. I've tried
    different combinations of the attributes above to no avail. What am I doing
    wrong? Does ListItemCollection have a default Editor that should just show
    up if I don't include any attributes (this doesn't happen for me)?

    cpnet, Sep 10, 2007
    1. Advertisements

  2. Hi cpnet,

    Due to how the UserControl is designed to work within the VSIDE, I don't
    think it's possible to achieve your objective here. I think you will need
    to create a custom server control (a composite control) to do that. Though
    this requires much code change. Please let me know if you need further
    information on how to do this with a custom server control.

    Walter Wang (, remove 'online.')
    Microsoft Online Community Support

    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.

    This posting is provided "AS IS" with no warranties, and confers no rights.
    Walter Wang [MSFT], Sep 11, 2007
    1. Advertisements

  3. cpnet

    cpnet Guest

    Hi Walter,

    I was beginning to suspect that this was the case. I've built server
    controls before so I should be ok to do that. I was just hoping to use a
    user control because this is just something quick and dirty for a prototype.

    cpnet, Sep 11, 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.