Hi
protected void btnDelete_Click(object sender, EventArgs e)
{
//Loop through all the rows in gridview
foreach (GridViewRow GridViewrow in GridView1.Rows)
{
//Finiding checkbox control in gridview for particular row
CheckBox chkdelete = (CheckBox)GridViewrow.FindControl("chkdelete");
//Condition to check checkbox selected or not
if (chkdelete.Checked)
{
//Getting UserId of particular row using datakey value
int Sno = Convert.ToInt32(GridView1.DataKeys[GridViewrow.RowIndex].Value);
SqlDataSource1.DeleteParameters["Sno"].DefaultValue =Sno.ToString();
SqlDataSource1.Delete();
}
when i wanted to execute this one getting this error:
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index