.aspx code <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server"> <asp:GridView ID="GridView1" runat="server"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:CheckBox ID="chkID" runat="server" /> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> </asp:Content>
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; }
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: