DotNetGnat
Programmer
ca8msm,
First of all thanks so much for helping me out on this one...
Here is the code i have so far...
aspx
code behind
works perfect...all the child datagrids are correctly populated with
inside the repeater...no problem there...
[red]can you please show me how to reference each dataview and where
to add/insert rows and do formatting...[/red]
Thanks so much...
-DNG
First of all thanks so much for helping me out on this one...
Here is the code i have so far...
aspx
Code:
<form id="Form1" method="post" runat="server">
<asp:repeater id="titleRepeater" runat="server" EnableViewState="False">
<ItemTemplate>
<b><%# DataBinder.Eval(Container.DataItem,"Item_No") %><br>
</b>
<asp:DataGrid ID="maingrid" Runat="server" AutoGenerateColumns=True DataSource='<%# GetDataSource( Container.DataItem )%>' OnItemDataBound="maingrid_showformatting" ShowFooter=True>
</asp:DataGrid>
<br>
</ItemTemplate>
</asp:repeater></form>
code behind
Code:
Private MyDataset As New DataSet
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
BindGrid()
End If
End Sub
Private Sub BindGrid()
Dim strConnection As String
strConnection = "my conn string"
Dim objConnection As OleDbConnection
objConnection = New OleDbConnection(strConnection)
objConnection.Open()
Dim MyDataRow As DataRow
Dim StrSQL As String = "my sql1"
Dim strSQL1 As String = "my sql 2"
Dim objDa As OleDbDataAdapter
Dim objDa1 As OleDbDataAdapter
objDa = New OleDbDataAdapter(StrSQL, objConnection)
objDa1 = New OleDbDataAdapter(StrSQL1, objConnection)
objDa.Fill(MyDataset, "Parent")
objDa1.Fill(MyDataset, "Child")
titleRepeater.DataSource = MyDataset.Tables("Parent")
titleRepeater.DataBind()
End Sub
Public Function GetDataSource(ByVal dataItem As Object) As DataView
Dim i As Integer = 0
Dim intNo As String = DataBinder.Eval(dataItem, "Item_No")
Dim dv As DataView = MyDataset.Tables("Child").DefaultView
dv.RowFilter = "Item_No='" & intNo & "'"
End Function
'for some formatting...
Sub maingrid_showformatting(ByVal sender As Object, ByVal e As DataGridItemEventArgs)
e.Item.Cells.RemoveAt(9)
e.Item.Cells(1).Text = DataBinder.Eval(e.Item.DataItem, "calcLength", "{0:#,###}")
e.Item.Cells(2).Text = DataBinder.Eval(e.Item.DataItem, "Width", "{0:#,###}")
end sub
works perfect...all the child datagrids are correctly populated with
inside the repeater...no problem there...
[red]can you please show me how to reference each dataview and where
to add/insert rows and do formatting...[/red]
Thanks so much...
-DNG