G
Guest
I am trying to use a DataList and the ItemTemplate.
I am binding the Datalist to a SQL query that gives me a list of Items with
a Parent Category.
I want to loop through all the items, but only print the Parent Category
once, regardless of how many child items are in it.
So my perfect output would look something like:
Category A
Item 1
Item 2
Item 3
Category B
Item 1
Category C
Item 1
Item 2
Can I use the ItemTemplate to produce this type of output?
I know that I can easily get this type of output
Category A
Item 1
Category A
Item 2
Category A
Item 3
Category B
Item 1
Category B
Item 2
Category C
Item 1
....
It does not appear that I can embed ASP code within the ItemTemplate tags?
If I try, then it says that I have not declared the Container object, which
holds the Item and Category values.
Am I missing something easy here?
I am binding the Datalist to a SQL query that gives me a list of Items with
a Parent Category.
I want to loop through all the items, but only print the Parent Category
once, regardless of how many child items are in it.
So my perfect output would look something like:
Category A
Item 1
Item 2
Item 3
Category B
Item 1
Category C
Item 1
Item 2
Can I use the ItemTemplate to produce this type of output?
I know that I can easily get this type of output
Category A
Item 1
Category A
Item 2
Category A
Item 3
Category B
Item 1
Category B
Item 2
Category C
Item 1
....
It does not appear that I can embed ASP code within the ItemTemplate tags?
If I try, then it says that I have not declared the Container object, which
holds the Item and Category values.
Am I missing something easy here?