• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 684
  • Last Modified:

Multiple ParseChildren In Custom List Control

Is there a way to have multiple parse children in a custom list control?

Right now I am using :
[
ParseChildren(true, "MyControl_one")
]

I also need to have two other types of controls within the parent and have them parsed into seperate collections.
0
clickclickbang
Asked:
clickclickbang
  • 2
1 Solution
 
AGBrownCommented:
C,

Me again :-)

I think we are now on the last comment of my first post to your previous question (if that made sense) but correct me if I'm wrong (http:Q_21803140.html).

As I understand it, what you want to do is something like:

<myControl:TheControl>
      <myControl:Employee>1</myControl:Employee>
      <myControl:Employee>2</myControl:Employee>
      <myControl:Employee>3</myControl:Employee>
      <myControl:Employee>4</myControl:Employee>
      <myControl:Customer>1</myControl:Customer>
      <myControl:Customer>2</myControl:Customer>
      <myControl:Customer>3</myControl:Customer>
      <myControl:Customer>4</myControl:Customer>
</myControl:TheControl>

Unfortunately, the PersistenceMode.InnerDefaultProperty doesn't let you do this, you can only have a single collection property for InnerDefaultProperty persistence in a control. Instead you need to define two more controls, each of which have an innerDefaultProperty that takes a collection. These would then be used with InnerProperty persistence in the outer control:

<myControl:TheControl>
      <EmployeeControl>
            <myControl:Employee>1</myControl:Employee>
            <myControl:Employee>2</myControl:Employee>
            <myControl:Employee>3</myControl:Employee>
            <myControl:Employee>4</myControl:Employee>
      </EmployeeControl>
      <CustomerControl>
            <myControl:Customer>1</myControl:Customer>
            <myControl:Customer>2</myControl:Customer>
            <myControl:Customer>3</myControl:Customer>
            <myControl:Customer>4</myControl:Customer>
      </CustomerControl>
</myControl:TheControl>

Now, I could have completely misunderstood the question; let me know if this is completely off-course. If I have misunderstood, post some of your control code and corresponding html/aspx and I'll try again.

Andy
0
 
clickclickbangAuthor Commented:
Andy - Thanks for your continued support :) I came to that conclusion over the weekend and implmeneted the "sub" controls to house their respective children thus making the outer most control the GrandParent of the bunch. Your samples and insight allowed me to answer this one on my own after I posted the question, so double thanks!!!

I'm going to award the question as I think it stands up as a great PAQ.
0
 
AGBrownCommented:
Thanks! Glad its all working, it took me a while to work all this out for myself when I had to do it.

Andy
0
 
shapeshifter999Commented:
Hello,

Sorry to revive this thread.

Is there somewhere an example how to implement a subcontrol?

Thank you,
Have a great day!
S├ębastien
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now