|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Parsing nested Tagsi'm a bit stuck at the following problem and hope any of you can provide me wit a nice solution: I have a company with multiple employees. When creating a company control i can define a property "employee" of type Employee (my own created class), but that's only one employee, i need multiple. I've found an example where an Employees property is called by using the ParseChildren(true,"Employees"), but that means that all children are considered employees, but i also have other properties like "address". And the example defines the property as type ArrayList. How is the designer to know what type of tag it is (nowhere is it defined as Employee)? So i'm looking for a way to identify the <employee> tag when the employee.get() property is called. below a sample code of what i've tried or trying to accomplish. Thanks for any replies. Sam. company.aspx: <company> <address>Street 1</address> <employee name="john" /> <employee name="sam" /> </company> Company.vb: <ParseChildren(True)> _ Public Class Company Inherits WebControl Public Property Address() As String ... End Property Private _elements As New ArrayList <PersistenceMode(PersistenceMode.InnerProperty)> _ Public ReadOnly Property Employee() As ArrayList Get Return _employees End Get End Property Private _elements As Employee[] <PersistenceMode(PersistenceMode.InnerProperty)> _ Public Property Employee() As Employee Get Return _employees[?] End Get Set(ByVal value As Employee) _employees[Employee.nr] = value End Set End Property End Class "> I've found an example where an Employees property is called by using the
> ParseChildren(true,"Employees"), but that means that all children are Yes, instead of using ArrayList, you should have strong-typed collection in > considered employees, but i also have other properties like "address". > And the example defines the property as type ArrayList. How is the > designer to know what type of tag it is (nowhere is it defined as > Employee)? > So i'm looking for a way to identify the <employee> tag when the > employee.get() property is called. > use. E.g collection typed for Employee object (in case for multiple possible employee types, typed for the common parent type if the collection stores them)
CompareValidator Only Works On Manual Input
Base Page Design Question Which page load fires first? ASPX or ASCX? PropertyDescriptor in GetDataSource style width and height Repeater question Resolving datasource expression Resolving datasource expression 2.0 ascx on a 1.1 aspx? Bizarre - DataGrid inside HTML Table |
|||||||||||||||||||||||