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:


    [EditorBrowsable(EditorBrowsableState.Always)]
    [Editor("System.ComponentModel.Design.CollectionEditor",
    typeof(System.Drawing.Design.UITypeEditor)]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
    public ListItemCollection Items1
    {
    get
    {
    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)?

    Thanks,
    cpnet
     
    cpnet, Sep 10, 2007
    #1
    1. Advertising

  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.


    Regards,
    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
    #2
    1. Advertising

  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.

    Thanks,
    cpnet
     
    cpnet, Sep 11, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. spamfurnace
    Replies:
    1
    Views:
    2,636
    Scott M.
    May 24, 2004
  2. Patrick Olurotimi Ige
    Replies:
    7
    Views:
    5,971
    Patrick Olurotimi Ige
    Jun 15, 2005
  3. Nathan Sokalski
    Replies:
    0
    Views:
    915
    Nathan Sokalski
    Oct 17, 2005
  4. Nathan Sokalski
    Replies:
    0
    Views:
    211
    Nathan Sokalski
    Oct 17, 2005
  5. Jurjen de Groot
    Replies:
    0
    Views:
    309
    Jurjen de Groot
    May 19, 2008
Loading...

Share This Page