// Data grid view multiple checkbox selection this shows how to use datagrid view and check boxes , and find which check box was checked
for (int i = 0; i < dgGrid.Rows.Count; i++)
{
GridViewRow row = dgGrid.Rows[i];
bool isChecked = ((CheckBox)row.FindControl("chkSelect")).Checked;
if (isChecked)
{
xSideID = dgGrid.Rows[i].Cells[1].Text;
}
}
<asp:GridView ID="dgGrid" runat="server" AutoGenerateColumns="false">
<columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox runat="server" ID="chkSelect" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="XsiteID" HeaderText="XsiteID" />
</columns>
</asp:GridView>
No comments:
Post a Comment