Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6697745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:29:47+00:00 2026-05-26T06:29:47+00:00

I’m trying to develop a custom control for asp.net that will have the following

  • 0

I’m trying to develop a custom control for asp.net that will have the following markup:

<bk:ControlMenu ID="cmTest" runat="server" Width="400px">               
    <Items>
        <asp:Textbox>
        <asp:Checkbox>
        [ List of controls... ]
    </Items>
</bk:ControlMenu>

What kind of property will allow me to do this when I’m developing my control? (The items collection being the part in question).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:29:48+00:00Added an answer on May 26, 2026 at 6:29 am

    You can’t have nested elements in a standard Web User Control. You’ll need to develop a custom server control to achieve that. To allow nested elements in a custom server control, you need to use the PersistenceMode attribute and set it to InnerProperty.

    /// <summary>
    /// Gets the columns collection.
    /// </summary>
    [Browsable(true)]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
    [PersistenceMode(PersistenceMode.InnerProperty)]
    public ItemCollection Items
    {
        get
        {
            if (itemCollection == null)
            {
                if (itemArrayList == null)
                {
                    this.EnsureChildControls();
                    if (itemArrayList == null)
                        itemArrayList = new ArrayList();
                }
                itemCollection = new ItemCollection(itemArrayList);
            }
            return itemCollection;
        }
    }
    

    Here’s an example from a control that I created:

    ScheduleGrid control

    /// <summary>
    /// Gets the columns collection.
    /// </summary>
    [Browsable(true)]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
    [PersistenceMode(PersistenceMode.InnerProperty)]
    public ScheduleGridColumnCollection Columns
    {
        get
        {
            if (scheduleColumnsCollection == null)
            {
                if (scheduleColumnsArrayList == null)
                {
                    this.EnsureChildControls();
                    if (scheduleColumnsArrayList == null)
                        scheduleColumnsArrayList = new ArrayList();
                }
                scheduleColumnsCollection = new ScheduleGridColumnCollection(scheduleColumnsArrayList);
            }
            return scheduleColumnsCollection;
        }
    }
    

    ScheduleGridColumn class

    #region schedule column
    
    [PersistChildren(true)]
    public sealed class ScheduleGridColumn : DataGridColumn, INamingContainer
    {
        #region private member variables
    
        private bool editModeEnabled;
        private bool aggregateColumn;        
    
        private string uniqueName;
        private string dataFieldName;
        private string aggregateKey;
        private string dataFormatString;
    
        private ITemplate editTemplate = null;
    
        #endregion
    
        #region constructor
    
        /// <summary>
        /// Initializes the GridColumn object using default values.
        /// </summary>
        public ScheduleGridColumn()
        {
            //initialize other fields to defaults
            dataFieldName = String.Empty;
            dataFormatString = String.Empty;
            uniqueName = String.Empty;
    
            //disable edit mode by default
            editModeEnabled = false;
        }
    
        #endregion
    
        #region properties
    
        /// <summary>
        /// Gets or sets the edit template.
        /// </summary>      
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible),
        PersistenceMode(PersistenceMode.InnerProperty),
        TemplateInstance(TemplateInstance.Single)]
        public ITemplate EditTemplate
        {
            get
            {
                return editTemplate;
            }
            set
            {
                editTemplate = value;
            }
        }
    
        /// <summary>
        /// Gets or sets the unique name.
        /// </summary>
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public string UniqueName
        {
            get
            {
                return uniqueName;
            }
            set
            {
                uniqueName = value;
            }
        }
    
        /// <summary>
        /// Gets or sets the name of the data field.
        /// </summary>
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public string DataField
        {
            get
            {
                return dataFieldName;
            }
            set
            {
                dataFieldName = value;
            }
        }
    
        /// <summary>
        /// Gets or sets the format string used to format the data.
        /// </summary>
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public string DataFormatString
        {
            get
            {
                return dataFormatString;
            }
            set
            {
                dataFormatString = value;
            }
        }
    
        /// <summary>
        /// Gets or sets a value indicating whether the item 
        /// is in edit mode.
        /// </summary>
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public bool EditModeEnabled
        {
            get
            {
                return editModeEnabled;
            }
            set
            {
                editModeEnabled = value;
            }
        }
    
        /// <summary>
        /// Gets or sets a value indicating whether the item should be aggregated.
        /// </summary>
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public bool AggregateColumn
        {
            get
            {
                return aggregateColumn;
            }
            set
            {
                aggregateColumn = value;
            }
        }
    
        /// <summary>
        /// Gets or sets the aggregate key.
        /// </summary>
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public string AggregateKey
        {
            get
            {
                return aggregateKey;
            }
            set
            {
                aggregateKey = value;
            }
        }
    
        #endregion
    }
    
    #endregion
    

    ScheduleGridColumnCollection class

    #region schedule column collection
    
    [PersistChildren(true)]
    public sealed class ScheduleGridColumnCollection : ICollection
    {
        #region member variables
    
        private ArrayList ItemArray;
        private string columnGroupTitle;
    
        #endregion
    
        #region constructors
    
        public ScheduleGridColumnCollection(ArrayList items)
        {
            ItemArray = items;
        }
    
        #endregion
    
        #region methods
    
        /// <summary>
        /// Finds the column corresponding to the data field.
        /// </summary>
        /// <param name="DataFieldName"></param>
        /// <returns></returns>
        public ScheduleGridColumn FindColumnDataField(string dataFieldName)
        {
            ScheduleGridColumn column = new ScheduleGridColumn();
            foreach (ScheduleGridColumn item in ItemArray.Cast<ScheduleGridColumn>())
            {
                if (item.DataField == dataFieldName)
                {
                    column = item;
                    break;
                }
            }
            return column;
        }
    
        public bool ContainsColumnWithDataField(string dataFieldName)
        {
            foreach (ScheduleGridColumn item in ItemArray.Cast<ScheduleGridColumn>())
                if (item.DataField == dataFieldName)
                    return true;
            return false;
        }
    
        /// <summary>
        /// Adds an item to the collection.
        /// </summary>
        /// <param name="item"></param>
        public void Add(ScheduleGridColumn item)
        {
            ItemArray.Add(item);
        }
    
        public void AddRange(ScheduleGridColumnCollection itemCollection)
        {
            foreach (ScheduleGridColumn item in itemCollection)
                ItemArray.Add(item);
        }
    
        /// <summary>
        /// Clears all items from the collection.
        /// </summary>
        public void Clear()
        {
            ItemArray.Clear();
        }
    
        /// <summary>
        /// Returns the enumerated equivalent of the collection.
        /// </summary>
        /// <returns></returns>
        public IEnumerator GetEnumerator()
        {
            return ItemArray.GetEnumerator();
        }
    
        /// <summary>
        /// Copies the collection to the array parameter.
        /// </summary>
        /// <param name="array"></param>
        /// <param name="index"></param>
        public void CopyTo(Array array, int index)
        {
            ItemArray.CopyTo(array, index);
        }  
    
        #endregion
    
        #region properties
    
        /// <summary>
        /// Gets the schedule column located at the specified index.
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public ScheduleGridColumn this[int index]
        {
            get
            {
                return (ScheduleGridColumn)ItemArray[index];
            }
        }
    
        /// <summary>
        /// Gets a schedule column from the collection based on a unique name.
        /// </summary>
        /// <param name="uniqueName"></param>
        /// <returns></returns>
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public ScheduleGridColumn this[string uniqueName]
        {
            get
            {
                ScheduleGridColumn dataColumn = null;
                foreach (object item in ItemArray)
                    if (((ScheduleGridColumn)item).UniqueName == uniqueName)
                        dataColumn = (ScheduleGridColumn)item;
                return dataColumn;
            }
        }
    
        /// <summary>
        /// Gets the total number of items in the collection.
        /// </summary>
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public int Count
        {
            get
            {
                return ItemArray.Count;
            }
        }
    
        /// <summary>
        /// Gets a value indicating whether the collection is read only.
        /// </summary>
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public bool IsReadOnly
        {
            get
            {
                return false;
            }
        }
    
        /// <summary>
        /// Gets a value indicating whether the collection is synchronized.
        /// </summary>
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public bool IsSynchronized
        {
            get
            {
                return false;
            }
        }
    
        /// <summary>
        /// Gets the sync root object.
        /// </summary>
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public object SyncRoot
        {
            get
            {
                return this;
            }
        }
    
        /// <summary>
        /// Gets or sets the column group title.
        /// </summary>
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        [Browsable(true)]
        public string ColumnGroupTitle
        {
            get
            {
                return columnGroupTitle;
            }
            set
            {
                columnGroupTitle = value;
            }
        }
    
        #endregion
    }
    
    #endregion
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post
I am trying to loop through a bunch of documents I have to put
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.