copy and paste the code is in
vb.net ...
--Save this as 'WebForm1.aspx'---------------
<%@ Page Language="
vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.
vb" Inherits="
VB.WebForm1"%>
<%@ Import Namespace="System.Data" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>nested</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form2" method="post" runat="server">
<asp:repeater id="parentRepeater" runat="server">
<HeaderTemplate>
<table border="1" width="300">
<tr>
<td width="100"><b>Size</b></td>
<td width="100"><b>Stock</b></td>
<td width="100"><b>Price</b></td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table border="1" width="300">
<tr>
<td width="100"><b><%# DataBinder.Eval(Container.DataItem,"Brand") %></b></td>
<td width="200" align="center"><b><%# DataBinder.Eval(Container.DataItem,"Code") %></b></td>
</tr>
</table>
<asp:repeater id="childRepeater" datasource='<%# CType(Container.DataItem,DataRowView).CreateChildV iew("OrderRelation") %>' runat="server">
<ItemTemplate>
<table border="1" width="300">
<tr>
<td width="100"><%# DataBinder.Eval(Container.DataItem, "[size]")%></td>
<td width="100"><%#CheckStock(Convert.ToInt32(DataBind er.Eval(Container.DataItem, "[stock]")))%></td>
<td width="100"><%# DataBinder.Eval(Container.DataItem, "[price]")%></td>
</tr>
</table>
</ItemTemplate>
</asp:repeater>
</td> </tr>
</ItemTemplate>
</asp:repeater>
</form>
</body>
</HTML>
--save this as 'WebForm1.aspx.
vb' --------
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
Public Class WebForm1
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents parentRepeater As System.Web.UI.WebControls.Repeater
Protected WithEvents Repeater1 As System.Web.UI.WebControls.Repeater
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
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 cnn As New SqlConnection("server=INSIGHT;UID=sa;PWD=Insight;d atabase=Pubs;")
Dim ds As New DataSet
cnn.Open()
Dim cmd1 As New SqlDataAdapter("select * from product", cnn)
Dim cmd2 As New SqlDataAdapter("select * from stock", cnn)
cmd1.Fill(ds, "product")
cmd2.Fill(ds, "stock")
ds.Tables(0).TableName = "product"
ds.Tables(1).TableName = "stock"
Dim Parent As DataColumn = ds.Tables("product").Columns("prod_id")
Dim Child As DataColumn = ds.Tables("stock").Columns("prod_id")
Dim ORelation As DataRelation = New DataRelation("OrderRelation", Parent, Child, False)
ds.Relations.Add(ORelation)
parentRepeater.DataSource = ds.Tables("product")
DataBind()
cnn.Close()
End Sub
' This function will take the stock and
' retrun you the label if there is Stock
' it will print Stock other wise it will
' print 'No Stock'
Protected Function CheckStock(ByVal Stock) As String
If (Stock > 0) Then
Return Stock.ToString()
Else
Return "No Stock"
End If
End Function
End Class
------
Plz let me know if it works for you...
Thanks
Nash