codebehind
Dim ChkSel As New CheckBox Dim CellValue As New StringCollection Dim tmpGV As New GridView tmpGV = FindControlRecursive(Page.Master, "GridView1") For i = 0 To tmpGV.Rows.Count - 1 ChkSel = DirectCast(DirectCast(tmpGV.Rows(i), GridViewRow).Cells(0), TableCell).Controls(1) If ChkSel.Checked = True Then CellValue.Add(DirectCast(tmpGV.Rows(i), GridViewRow).Cells(1).Text) End If Next private Control FindControlRecursive(Control root, string id) { if (root.ID == id) { return root; } foreach (Control c in root.Controls) { Control t = FindControlRecursive(c, id); if (t != null) { return t; } } return null; }
|