Hi,
I have 2 rows in gridview with checkbox, checkbox checked data I want to insert in database.
I have created this code but here row is showing 0 so its not working
submit button click
foreach (GridViewRow row in grdv_rights.Rows)
{
CheckBox chk = (CheckBox)row.FindControl("chkSelect");
if (chk.Checked)
{
lbl_user_rights.Text = "test msg";
}
}
{
CheckBox chk = (CheckBox)row.FindControl("chkSelect");
if (chk.Checked)
{
lbl_user_rights.Text = "test msg";
}
}
please tell me the issue.

Manikavelu VelayuthamRank #413 · 6K reputationPosted Feb 18, 2014, 1:00 AM EST
Is it a web or windows application ?
Is it a XAML based application ?
Based on that we can fix your issue
Biswa Pujarini MohapatraRank #465 · 5.4K reputationPosted Feb 18, 2014, 1:48 AM EST
//change your cell index as per your reuirement
DataGridViewCheckBoxCell chkchecking = roow.Cells[0] as DataGridViewCheckBoxCell; if ((bool)chkchecking.Value == true) { }