DataList is the server control of "Items in the Template Display Data Source", if nested, for display hierarchical data is a good choice, (hierarchical data seems to have many provinces in China, there are many counties under the province, There are many townships in the county), which describes how to implement this function. (Also suitable for nested DataGrid & Repeater)
First look at the following example, Channels is here "Channel", there are many columns "columns" under Channels "to display, as if Sina.com's" Life Channel "has a lot of columns, about men and women, etc.
The program first creates a DataList (id = DATALIST1) to display all Channels, then determine in DataList1's OnItemCreated event When each Item or AlternatingItem is created, we use the program to dynamically generate a DataList to display the columns under this Channel, in Dynamically generate DataList's creation of "Display Template" is important, where we use the itemplate interface, custom MyTemp display template, and its role is to display the binding data.