Hello Guys, here is what i am trying to do...i am trying to add some rows(subheading rows) to the child grid inside the master datagrid and not sure where to do it...
i have filled my datasets as below for master and child grids
oDA.Fill(oDataSet, "items")
oDA.SelectCommand.CommandText = sql2
oDA.Fill(oDataSet, "itemdetails")
here is the relationship
Dim rel As New DataRelation("payrecord", _
oDataSet.Tables("items").Columns("Item_No"), _
oDataSet.Tables("itemdetails").Columns("Item_No"))
oDataSet.Relations.Add(rel)
here is the sub to bind child grids
Sub BindItemDetails(ByVal sender As Object, ByVal e As DataGridItemEventArgs)
Dim oType As ListItemType = CType(e.Item.ItemType, ListItemType)
If oType = ListItemType.Item Or oType = ListItemType.AlternatingItem Then
Dim oGrid As DataGrid = CType(e.Item.FindControl("dgr2"), DataGrid)
Dim skey As String = dgr1.DataKeys(e.Item.ItemIndex)
Dim oView, oChildView As DataView
oView = oDataSet.Tables("items").DefaultView
oView.RowFilter = "Item_No='" & skey & "'"
oChildView = oView(0).CreateChildView(oDataSet.Relations("payrecord"))
oGrid.DataSource = oChildView
oGrid.DataBind()
End If
End Sub
works fine...but as i said i need to insert somerows to the childgrid which i am not sure where to do...
thanks