Datagrid as cell in asp:table

webcard

New member
Joined
Feb 16, 2003
Messages
1
Im trying to organized several datagrids pulled from different database tables onto one webform page.

Thought an asp:table might do the trick.

Ive named all my datagrids beginning with "dg", so Im iterating
through the Page.controls to find controls with ids starting with "dg"

When I locate one, I add it as a cell to my table.

When the code is run, the datagrids are not visible in the table.
Any idea why?

TIA

Heres the code:

Private Sub PostionGrids()
Dim rowGrids As TableRow
Dim cellGrid As TableCell
Dim strObjName As String
Dim i, itemcount As Integer

rowGrids = New TableRow()
Dim ctl As Control
For Each ctl In Page.Controls

If ctl.GetType().ToString() = "System.Web.UI.HtmlControls.HtmlForm" Then
Dim ctrlItem As Control
itemcount = ctl.Controls.Count - 1
For i = itemcount To 0 Step -1
strObjName = ctl.Controls.Item(i).ClientID
If Mid(strObjName, 1, 2) = "dg" Then
ctrlItem = ctl.Controls.Item(i)
cellGrid = New TableCell()
cellGrid.Controls.Add(ctrlItem)
rowGrids.Cells.Add(cellGrid)
End If
Next
End If
Next ctl

tblGrids.Rows.Add(rowGrids)


End Sub
 
Back
Top