D
darrel
In our admin screens, I often need to access a list of categories and bind
them to a DDL for people to pick from.
There are two levels of categories, so, up to this point, I've been using a
recursive query to grab them all. All top-level categories are added one by
one, and then all second level categories are added with a ' - - ' prefix.
So my eventual list looks like this:
item 1
- - item 1a
- - item 1b
- - item 1c
item 2
- - item 2a
item 3
- - item 3a
- - etc...
This makes it fairly intuitive to the person which level of category they
are selecting.
Now, since this is on the admin-side, and isn't getting a heavy load of
users, the recursive call isn't really that big of a deal. However, I
thought I'd streamline things a bit and instead of doing a recursive DB
call, just grab the same data from a nexted XML file.
Importing a flat XML file and binding to a DDL is easy enough, but how do I
do that and preserve the nesting? Would I do it the same way, grabbing the
XML file and reading it record-by-record manually formatting each item?
-Darrel
them to a DDL for people to pick from.
There are two levels of categories, so, up to this point, I've been using a
recursive query to grab them all. All top-level categories are added one by
one, and then all second level categories are added with a ' - - ' prefix.
So my eventual list looks like this:
item 1
- - item 1a
- - item 1b
- - item 1c
item 2
- - item 2a
item 3
- - item 3a
- - etc...
This makes it fairly intuitive to the person which level of category they
are selecting.
Now, since this is on the admin-side, and isn't getting a heavy load of
users, the recursive call isn't really that big of a deal. However, I
thought I'd streamline things a bit and instead of doing a recursive DB
call, just grab the same data from a nexted XML file.
Importing a flat XML file and binding to a DDL is easy enough, but how do I
do that and preserve the nesting? Would I do it the same way, grabbing the
XML file and reading it record-by-record manually formatting each item?
-Darrel