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

  • Home
  • SEARCH
  • 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 7022005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:31:26+00:00 2026-05-27T23:31:26+00:00

I have three classes and a user control that will use these three classes.

  • 0

I have three classes and a user control that will use these three classes.
Here are the classes and their explanations:

//provides access to multiple ManagementMethods
[Serializable(), ParseChildren(true)]
public class ManagementDelegate
{
     [Browsable(true), EditorBrowsable(EditorBrowsableState.Always),
     PersistenceMode(PersistenceMode.InnerProperty)]
     public List<ManagementMethod> Method
     {
         get; set;
     }
}
//provides access to multiple ManagementParameters and the method name
[Serializable(), PersistChildren(false)]
public class ManagementMethod
{
     [Browsable(true), EditorBrowsable(EditorBrowsableState.Always)]
     public string Name
     {
         get; set;
     }
     [Browsable(true), EditorBrowsable(EditorBrowsableState.Always),
     PersistenceMode(PersistenceMode.InnerProperty)]
     public List<ManagementParameter> Parameter
     {
         get; set;
     }
}
//describes a parameter of method.
[Serializable(), PersistChildren(false)]
public class ManagementParameter
{
     [Browsable(true), EditorBrowsable(EditorBrowsableState.Always)]
     public string ParameterName
     {
         get; set;
     }
}
//===============================
//here is the part of user control code behind that uses the ManagementDelegate class.
[Browsable(true), EditorBrowsable(EditorBrowsableState.Always),
PersistenceMode(PersistenceMode.InnerProperty)]
public ManagementDelegate SelectMethods
{
    get; set;
}

So here is an example of the structure that I’m looking for:

<UC:MyUc ID="test" runat="server">
    <SelectMethods>
        <!-- here when i open a tag asp.net lists the Method, but when i try to set the Name attribute it warns and won't run. -->
        <Method Name="meth">
            <Parameter ParameterName="id" />
            <Parameter ParameterName="word" />
        </Method
        <Method Name="meth2">
        </Method
    </SelectMethods>
</UC:MyUc>

The problem is that ASP.net recognizes the SelectMethod as an inner tag, it even recognizes the Method tag as an inner tag but it doesn’t recognize the type of Method tag which actually is ManagementMethod. When I change the type of any of the properties to a simple type, for example change the List to just ManagementMethod, ASP.net recognizes it and everything works fine. Thee same goes with any List<> object.

  • 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-27T23:31:27+00:00Added an answer on May 27, 2026 at 11:31 pm

    Here is a snippet from our production code, you can see that the ControlDependency class even allows children of ControlDependency

    [PersistChildren(false), TypeConverter(typeof(ExpandableObjectConverter)), ParseChildren(true), Serializable()]
        public class ControlDependencySetting
        {
            [System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content),
                PersistenceMode(PersistenceMode.InnerProperty)]
            public List<ControlDependency> ControlDependencies { get; set; }
    
            ***Code emitted
        }
    
    [PersistChildren(false), TypeConverter(typeof(ExpandableObjectConverter)), ParseChildren(true),Serializable()]
        public class ControlDependency
        {
            [System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content), 
                PersistenceMode(PersistenceMode.InnerProperty)]
            public List<ControlDependency> ControlDependencies { get; set; }
    
           **Code Emitted
    
        }
    

    And is declared in the custom control as

    [System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content),
        PersistenceMode(PersistenceMode.InnerProperty),
        NotifyParentProperty(true)]
        public List<ControlDependencySetting> ControlDependencySettings { get; set; }
    

    Also note that i do create an instance of these lists in each constructor.

    *EDIT***

    You have called your list Method and your element Method , you are expecting child elements of ManagementDelegate to be automatically added to the list called Method, this is not how it works, when you want to add to the list you need to specify the list element and add inside of it , you have done the same for parameters.

    This is what your current structure would be expecting.

    <SelectMethods> 
      <Method> <--Now this is the list of methods, you have also called it method        
          <Method Name="meth"> <-- This is an element of the method type to add to the list you have called Method
                <Parameter> <-- This is the list of parameters you have called it Parameter
                    <Parameter ParameterName="id" />   <--parameter element             
                    <Parameter ParameterName="word" />                
                <Parameter>
          </Method>
      </Method>
    

    You should rename to Methods and Parameters and use accordingly or re-structure your layout.

    Something like

        //provides access to multiple ManagementMethods
    [Serializable(), ParseChildren(true)]
    public class ManagementDelegate
    {
         [Browsable(true), EditorBrowsable(EditorBrowsableState.Always),
         PersistenceMode(PersistenceMode.InnerProperty)]
         public List<ManagementMethod> Methods
         {
             get; set;
         }
    }
    
    //provides access to multiple ManagementParameters and the method name
    [Serializable(), PersistChildren(false),TypeConverter(typeof(ExpandableObjectConverter))]
    public class ManagementMethod
    {
         [Browsable(true), EditorBrowsable(EditorBrowsableState.Always)]
         public string Name
         {
             get; set;
         }
         [Browsable(true), EditorBrowsable(EditorBrowsableState.Always),
         PersistenceMode(PersistenceMode.InnerProperty)]
         public List<ManagementParameter> Parameters
         {
             get; set;
         }
    }
    //describes a parameter of method.
    [Serializable(), PersistChildren(false),TypeConverter(typeof(ExpandableObjectConverter))]
    public class ManagementParameter
    {
         [Browsable(true), EditorBrowsable(EditorBrowsableState.Always)]
         public string ParameterName
         {
             get; set;
         }
    }
    //===============================
    //here is the part of user control code behind that uses the ManagementDelegate class.
    [Browsable(true), EditorBrowsable(EditorBrowsableState.Always),
    PersistenceMode(PersistenceMode.InnerProperty)]
    public ManagementDelegate SelectDelegate
    {
        get; set;
    }
    

    Then

    <UC:MyUc ID="test" runat="server">
        <SelectDelegate>
           <Methods>
              <Method Name="meth">
                <Parameters>
                    <Parameter ParameterName="id" />
                    <Parameter ParameterName="word" />
                <Parameters>
              </Method>
              <Method Name="meth2">
              </Method>
            </Methods>
        </SelectDelegate>
    </UC:MyUc>
    

    I believe there may also be away to specify that innner content belongs to a specific property by default, see PersistenceMode.InnerDefaultProperty – but i have never tried this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET user control that references some CSS classes. In the Error
I have three classes that all have a static function called 'create'. I would
I have two classes that my pages and controls inherit from. These two classes
I have three different websites that uses some base classes, usercontrols. And my questions
i have 2 classes(a form class and a user-control class) and in the form
I have three classes; Classes A and B both reference class C . How
Suppose I have three classes. It is valid to instantiate A, but there are
Say I have three classes: class X{}; class Y{}; class Both : public X,
If I have three classes, A, B, C. A and B are friends (bidirectionally).
If I have three classes class A class B extends A class C extends

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.