<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Drawing" %>
 <script language="VB" runat="server">
'Public Variable for each exposed Property 
PUBLIC	vGridLines As GridLines
'If we declare this as string , 
'will have to use FromName method to convert to color
PUBLIC vBorderColor as String 
PUBLIC  vCellPadding As Integer
Sub Page_Load(Src As Object, E As EventArgs)
        If Not IsPostBack
            LoadData()
        End If
End Sub
Sub LoadData
    Dim ds          As New DataSet
    Dim fs          As filestream
    dim xmLStream   As StreamReader
    Dim Source as DataView

    Source = Cache("MyData")
    If Source is Nothing
    	fs = New filestream(Server.MapPath("nav.xml"), FileMode.Open, FileAccess.Read)
    	xmlStream = new StreamReader(fs)
	ds.ReadXML(XmlStream)
	fs.Close()
	Source = New DataView(ds.Tables(0))
	' cache it for future use
	Cache.Insert("MyData", Source, New CacheDependency(Server.MapPath("nav.xml")))	
	' we created the data explicitly, so advertise that fact
        CacheMsg.Text = "Dataset created explicitly"
     Else
                 CacheMsg.Text = "Dataset retrieved from cache"        
     End If
     dlist.DataSource=Source    'ds.Tables("site").DefaultView
     dlist.DataBind()
    dlist.GridLines = vGridLines
    'dlist.BorderColor=vBorderColor
    'If VBorderColor was declared as string, we would use
    dlist.BorderColor=System.Drawing.Color.FromName(vBorderColor)
    dlist.CellPadding=vCellPadding
End Sub
</script>
<asp:DataList runat=server id="dlist"
 RepeatDirection="horizontal" 
 RepeatMode="Table"
 Width="100%"
 BorderWidth="1"
 Font-Name="Verdana"
 Font-Size="8pt"
 HeaderStyle-BackColor="#aaaadd"
 SelectedItemStyle-BackColor="yellow"
 ItemStyle-BackColor="antiquewhite"
 AlternatingItemStyle-BackColor="tan"
  >
<ItemTemplate>
	<asp:HyperLink runat="server" 
	Text= '<%# Container.DataItem("sitename") %>'
	NavigateUrl= '<%# Container.DataItem("siteurl") %>' />
</ItemTemplate>
</asp:DataList>
<i><asp:label id="CacheMsg" runat="server"/></i></p>
