Private Sub Page_Load (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here Dim dl As New DataList dl.HeaderTemplate = New CreateDL (ListItemType.Header) dl.ItemTemplate = New CreateDL (ListItemType.Item) dl.AlternatingItemTemplate = New CreateDL (ListItemType.AlternatingItem) dl.FooterTemplate = New CreateDL (ListItemType.Footer) Dim d As New Data dl.DataSource = d.getTree dl.DataBind () div1.Controls .Add (dl)
End Sub
Public Class Createdl Implements Itemplate Shared Itemcount AS Integer = 0 Dim TemplateType As ListItemType
Sub New (Byval Type As ListItemType) Templattype = Type End Sub
Sub InstantiateIn (ByVal container As Control) Implements ITemplate.InstantiateIn Dim lc As New Literal Select Case TemplateType Case ListItemType.Header lc.Text = "