.NET data formatting question...

Diabolic

Veteran X
Is it possible to format a DataList using the <ItemTemplate> (or other) tag so that one column only displays a value when a new/different value occurs? An example would be something like the following, assuming all data is derived from one table, in a single query:

Code:
ItemId_1          Option_1        Price_1
                  Option_2        Price_2  ' No change because ItemId is still "ItemId_1"
                  Option_3        Price_3
ItemId_2          Option_4        Price_4  ' Changes here 
                  Option_5        Price_5

Any help is greatly appreciated.
 
You can accomplish this with nested DataLists or with Nested Repeaters. In order to accomplish nested controls, you need to instantiate the second control from within the ItemDataBound event.

Here's a Repeater example for you:
http://www.mostlylucid.co.uk/articles/nestedrepeaters.htm

If you run into problems, you can always resort to the original <% Do While !Recordset.EOF %> logic from inside your DataList or Repeater.
 
LostAngel said:
If you run into problems, you can always resort to the original <% Do While !Recordset.EOF %> logic from inside your DataList or Repeater.

That's basically what I had ("for each dataRow in dataSet.Tables(0).Rows") but I was thinking a dataList/Grid/Display surely had a method that would handle it.

Much appreciated!
 
Back
Top