<% @ Page Language = "VB" autoeventwireup = "false" codefile = "menuall. aspx. VB" inherits = "emeng. menuall" %>
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head runat = "server">
<Title> untitled faces </title>
</Head>
<Body>
<Form ID = "form1" runat = "server">
<Div>
<Asp: repeater id = "parentrepeater" runat = "server">
<Itemtemplate>
<% # Databinder. eval (container. dataitem, "span") %>
<Asp: repeater id = "childrepeater" runat = "server" datasource = '<% # container. dataitem ("myrelation") %>'>
<Itemtemplate>
<% # Databinder. eval (container. dataitem, "menu") %>
</Itemtemplate>
</ASP: repeater>
</Itemtemplate>
</ASP: repeater>
</Div>
</Form>
</Body>
</Html>
Imports system
Imports system. Data
Imports system. Data. sqlclient
Imports system. Web
Imports system. Web. sessionstate
Imports system. Web. UI
Imports system. Web. UI. webcontrols
Namespace emeng
Public class menuall
Inherits system. Web. UI. Page
'Dim parentrepeater as system. Web. UI. webcontrols. Repeater
Public sub page_load (byval sender as object, byval e as eventargs) handles me. Load
'Create a connection and dataadapter for the authors table
Dim cnnstring as string = configurationmanager. connectionstrings ("CNN"). connectionstring
Dim CNN as new sqlconnection (cnnstring)
Dim cmd1 as new sqldataadapter ("select * From c_menuheader", CNN)
'create a filled dataset.
dim ds as new dataset ()
limit 1.fill (DS, "menuheader")
'sqlhelper. excutereadapdater ("select * from authors", commandtype. text, nothing)
'create a dataadapter for the titles table
dim cmd2 as new sqldataadapter ("select * From c_menuleft", CNN)
limit 2.fill (DS, "menuleft")
'Create the relationship between the authors table and the titles table.
DS. relations. add ("myrelation", DS. tables ("menuheader "). columns ("ID"), DS. tables ("menuleft "). columns ("PID "))
'Bind authors to parent Repeater
Parentrepeater. datasource = Ds. Tables ("menuheader ")
Page. databind ()
CNN. Close ()
CNN. Dispose ()
End sub
End Class
End namespace