danabnormal
Technical User
Think I'm about to put a fist thru my screen... Save my laptop!
I think this is stupidly simple.
I have a form where the user selects a list of reports that they want to show. When the form is submitted, I am counting the number of selected reports in order to then generate a table that contains the correct number of cells and then puts that table into a placeholder..
Function drawTable(ByVal numCharts)
Dim tbl2 As New Table
tbl2.ID = "DataTableInnit"
Dim tr1 As New TableRow
Dim tc1 As New TableCell
Dim myPlc As New PlaceHolder
Dim thead As TableHeaderRow = New TableHeaderRow
Dim thc1 As TableHeaderCell = New TableHeaderCell
thc1.Text = "here"
thc1.ID = "thc1"
thead.ID = "thead1"
tr1.ID = "tr1"
thead.Controls.Add(thc1)
tbl2.Controls.Add(thead)
'Dim myTable, myRows
'myTable = "<table width=""100%"" cellpadding=""10"" id=""tblReports"" runat=server>"
Select Case numCharts
Case 1
'myRows = "<tr id = ""row1""><td width=""100%""><asplaceHolder runat=server ID=""dashPlace1"" /></td></tr>"
myPlc.ID = "dashPlace1"
tc1.Controls.Add(myPlc)
tr1.Controls.Add(tc1)
tbl2.Controls.Add(tr1)
Case Else
For a = 1 To numCharts
'myRows = "<tr><td width=""50%""><asplaceHolder runat=server ID=""dashPlace""" & a & """ /></td><td width=""50%""><asplaceHolder runat=server ID=""dashPlace""" & a + 1 & """ /></td></tr>"
'a = a + 1
Next
End Select
'myTable = myTable & myRows & "</table>"
drawTable = tbl2
'drawTable = myTable & "TABLEISHERE"
End Function
If I run through the process on the site and check the resulting source, I see dashPlace1 in the source so I know that the table is generated.
Now.
For the life of me I cannot locate the dashPlace1 control in order to place an object within it. I can locate the table, and within that the row, but I cannot locate the dashPlace1 PlaceHolder object within it.
'Dim myCon As New Control
'Dim myctl As New Control
'For Each myCon In tbl.Controls
' MsgBox("tbl:" & myCon.ID)
' Next
'myctl = tbl.FindControl("thead1")
'MsgBox(myctl.HasControls)
'For Each myCon In myctl.Controls
' MsgBox(myCon.ID)
'Next
'Next
Any tips??
(Oh, and apologies if the above code is messymessymessy...)
I think this is stupidly simple.
I have a form where the user selects a list of reports that they want to show. When the form is submitted, I am counting the number of selected reports in order to then generate a table that contains the correct number of cells and then puts that table into a placeholder..
Function drawTable(ByVal numCharts)
Dim tbl2 As New Table
tbl2.ID = "DataTableInnit"
Dim tr1 As New TableRow
Dim tc1 As New TableCell
Dim myPlc As New PlaceHolder
Dim thead As TableHeaderRow = New TableHeaderRow
Dim thc1 As TableHeaderCell = New TableHeaderCell
thc1.Text = "here"
thc1.ID = "thc1"
thead.ID = "thead1"
tr1.ID = "tr1"
thead.Controls.Add(thc1)
tbl2.Controls.Add(thead)
'Dim myTable, myRows
'myTable = "<table width=""100%"" cellpadding=""10"" id=""tblReports"" runat=server>"
Select Case numCharts
Case 1
'myRows = "<tr id = ""row1""><td width=""100%""><asplaceHolder runat=server ID=""dashPlace1"" /></td></tr>"
myPlc.ID = "dashPlace1"
tc1.Controls.Add(myPlc)
tr1.Controls.Add(tc1)
tbl2.Controls.Add(tr1)
Case Else
For a = 1 To numCharts
'myRows = "<tr><td width=""50%""><asplaceHolder runat=server ID=""dashPlace""" & a & """ /></td><td width=""50%""><asplaceHolder runat=server ID=""dashPlace""" & a + 1 & """ /></td></tr>"
'a = a + 1
Next
End Select
'myTable = myTable & myRows & "</table>"
drawTable = tbl2
'drawTable = myTable & "TABLEISHERE"
End Function
If I run through the process on the site and check the resulting source, I see dashPlace1 in the source so I know that the table is generated.
Now.
For the life of me I cannot locate the dashPlace1 control in order to place an object within it. I can locate the table, and within that the row, but I cannot locate the dashPlace1 PlaceHolder object within it.
'Dim myCon As New Control
'Dim myctl As New Control
'For Each myCon In tbl.Controls
' MsgBox("tbl:" & myCon.ID)
' Next
'myctl = tbl.FindControl("thead1")
'MsgBox(myctl.HasControls)
'For Each myCon In myctl.Controls
' MsgBox(myCon.ID)
'Next
'Next
Any tips??
(Oh, and apologies if the above code is messymessymessy...)