Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Creating an ASP.NET UserControl with collection-type property

Creating an ASP.NET UserControl with collection-type property

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-netsysadmin
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kensai
    wrote on last edited by
    #1

    How can I create a UserControl with a collection-type property which has a collection editor? I've a CompositeControl with an ArrayList-type property which has CollectionEditor-type designer. You can see this property on Properties window with a "..." button which launches a collection editor. This works fine and all but I want to apply the same to a UserControl and I've couldn't manage to pull it off so far. I've done the same thing what I've done with my CompositeControl but the property either doesn't even show on Properties window of the UserControl or shows as a single value property with no "..." editor button. This is what I've done with CompositeControl:

    [
    DefaultProperty("Contacts"),
    ParseChildren(true, "Contacts"),
    ToolboxData(
    "<{0}:QuickContacts runat=\"server\"> </{0}:QuickContacts>")
    ]
    public class QuickContacts : CompositeControl
    {
    private ArrayList contactsList;

    \[
    DesignerSerializationVisibility(
        DesignerSerializationVisibility.Content),
    Editor(typeof(ContactCollectionEditor), typeof(UITypeEditor)),
    PersistenceMode(PersistenceMode.InnerProperty)
    \]
    public ArrayList Contacts
    {
        get
        {
            if (contactsList == null)
            {
                contactsList = new ArrayList();
            }
            return contactsList;
        }
    }
    
    A 1 Reply Last reply
    0
    • K kensai

      How can I create a UserControl with a collection-type property which has a collection editor? I've a CompositeControl with an ArrayList-type property which has CollectionEditor-type designer. You can see this property on Properties window with a "..." button which launches a collection editor. This works fine and all but I want to apply the same to a UserControl and I've couldn't manage to pull it off so far. I've done the same thing what I've done with my CompositeControl but the property either doesn't even show on Properties window of the UserControl or shows as a single value property with no "..." editor button. This is what I've done with CompositeControl:

      [
      DefaultProperty("Contacts"),
      ParseChildren(true, "Contacts"),
      ToolboxData(
      "<{0}:QuickContacts runat=\"server\"> </{0}:QuickContacts>")
      ]
      public class QuickContacts : CompositeControl
      {
      private ArrayList contactsList;

      \[
      DesignerSerializationVisibility(
          DesignerSerializationVisibility.Content),
      Editor(typeof(ContactCollectionEditor), typeof(UITypeEditor)),
      PersistenceMode(PersistenceMode.InnerProperty)
      \]
      public ArrayList Contacts
      {
          get
          {
              if (contactsList == null)
              {
                  contactsList = new ArrayList();
              }
              return contactsList;
          }
      }
      
      A Offline
      A Offline
      Ali Al Omairi Abu AlHassan
      wrote on last edited by
      #2

      Sir, I am not an expert but i think you can use the ViewState object.

      Help people,so poeple can help you.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups