P
Pab
Hi,
I faced with my understanding about “ParseChildrenAttribute†class using. My
example is following: two classes are created: Employee and
CollectionEmployee. To CollectionEmployee class I applied ParseChildren
attribyte as “[ParseChildren(typeof(Employee))]â€, but I don’t know how to
collect Employee in CreateChildControls method (Controls collection is
empty). If I’ll replace line “[ParseChildren(typeof(Employee))]’ with
“[ParseChildren(true, "Employees")]†so I can access Employee instances in
“Employees’ Array List. Not bad, but in this case when I try to write tag
under “<CollectionEmployee >†tag in VS editor, IntelliSense offer list of in
all classes in “t†namespace – it’s not right. So both cases are no
convenient, can anybody help me with this task?
Namespace t
{
public sealed class Employee: WebControl
{…}
[ParseChildren(typeof(Employee))]
public sealed class CollectionEmployee: WebControl
{..
private ArrayList employees = new ArrayList();
public ArrayList Employees
{
get
{
return employees;
}
}
protected override void CreateChildControls()
{
??????????
}
..
}
}
<body>
<form id="form1" runat="server">
<t.CollectionEmployee id=" CollectionChildControl1" runat="server">
<t.Employee Name="Employee 1"
Title="Title 1" />
<t.Employee Name="Employee 2"
Title="Title 2" />
</t.CollectionEmployee >
…..
I faced with my understanding about “ParseChildrenAttribute†class using. My
example is following: two classes are created: Employee and
CollectionEmployee. To CollectionEmployee class I applied ParseChildren
attribyte as “[ParseChildren(typeof(Employee))]â€, but I don’t know how to
collect Employee in CreateChildControls method (Controls collection is
empty). If I’ll replace line “[ParseChildren(typeof(Employee))]’ with
“[ParseChildren(true, "Employees")]†so I can access Employee instances in
“Employees’ Array List. Not bad, but in this case when I try to write tag
under “<CollectionEmployee >†tag in VS editor, IntelliSense offer list of in
all classes in “t†namespace – it’s not right. So both cases are no
convenient, can anybody help me with this task?
Namespace t
{
public sealed class Employee: WebControl
{…}
[ParseChildren(typeof(Employee))]
public sealed class CollectionEmployee: WebControl
{..
private ArrayList employees = new ArrayList();
public ArrayList Employees
{
get
{
return employees;
}
}
protected override void CreateChildControls()
{
??????????
}
..
}
}
<body>
<form id="form1" runat="server">
<t.CollectionEmployee id=" CollectionChildControl1" runat="server">
<t.Employee Name="Employee 1"
Title="Title 1" />
<t.Employee Name="Employee 2"
Title="Title 2" />
</t.CollectionEmployee >
…..