Hi all,
I am having a bit of a nightmare i am creating controls at runtime in a panel, in another panel and then inside a table. The only way i can figure out how to access these dynamically created controls is with this massive loop/if structure. Does anyone know of an easier method.
Many thanks in advance for any assistance
Deleco
Deleco
I am having a bit of a nightmare i am creating controls at runtime in a panel, in another panel and then inside a table. The only way i can figure out how to access these dynamically created controls is with this massive loop/if structure. Does anyone know of an easier method.
Code:
For Each ctrl In pnlParent.Controls
If ctrl.GetType.FullName = "System.Web.UI.WebControls.Panel" Then
For Each ctrl2 In ctrl.Controls
If ctrl2.GetType.FullName = "System.Web.UI.WebControls.Table" Then
tbl = ctrl2
For Each ctrl3 In tbl.Rows
If ctrl3.Cells(1).Controls.Count > 0 Then
chk = ctrl3.Cells(1).Controls(0)
If chk.Checked = True Then
Dim dr As DataRow
Dim sSplit() As String
sSplit = Split(chk.ID, "^")
dr.Item("PROLE_ID") = sSplit(0).ToString
dr.Item("COURSE_ID") = sSplit(1).ToString
dr.Item("DELEGATE_NAME") = sSplit(2).ToString
dt.Rows.Add(dr)
dt.AcceptChanges()
End If
End If
Next
End If
Next
End If
Next
Many thanks in advance for any assistance
Deleco
Deleco